import { lib, game, ui, get, ai, _status } from "../../noname.js";
export const type = "extension";
export default function(){
	return {name:"车万符斗祭",content:function(config,pack){
    lib.group.add('fdj');
    lib.translate.fdj = '符';
    lib.translate.fdj2 = '符';
    lib.groupnature.fdj = 'fdj';

},precontent:function(){
    
},help:{},config:{},package:{
    character: {
        character: {
            yuyuko: ["female","fdj",3,["yuyuko_pcb","yuyuko_souldrain","yuyuko_pcb_extract","ganjin"],["des:幽冥阁楼的吃货少女 西行寺幽幽子 体力：3。（画师：和茶，CV：VV）","ext:车万符斗祭/image/figure/yuyuko.jpg","die:ext:车万符斗祭/audio/die/yuyuko.mp3"]],
            daiyousei: ["female","fdj",3,["daiyousei_support","daiyousei_moe","ganjin"],["des:全身萌点的保姆 大妖精 体力：3。（画师：渚FUN，CV：简翎）","ext:车万符斗祭/image/figure/daiyousei.jpg","die:ext:车万符斗祭/audio/die/daiyousei.mp3"]],
            flandre: ["female","fdj",4,["flandre_csd","flandre_cs","ganjin"],["des:恶魔之妹 芙兰朵露 体力：4。（画师：月见，CV：shourei小N）","ext:车万符斗祭/image/figure/flandre.jpg","die:ext:车万符斗祭/audio/die/flandre.mp3"]],
            shinmyoumaru: ["female","fdj",4,["shinmyoumaru_venge","shinmyoumaru_mallet","ganjin"],["des:进击的小人 少名针妙丸 体力：4。（画师：六仔OwO，CV：小羽，人物设计：yourccz95）","ext:车万符斗祭/image/figure/shinmyoumaru.jpg","die:ext:车万符斗祭/audio/die/shinmyoumaru.mp3"]],
            seiga: ["female","fdj",4,["seiga_heterodoxy","seiga_extend","ganjin"],["des:僵尸别跑 霍青娥 体力：4。（画师：和茶，CV：小羽）","ext:车万符斗祭/image/figure/seiga.jpg","die:ext:车万符斗祭/audio/die/seiga.mp3"]],
            "test_1": ["female","fdj",4,["ganjin","t","mikittawa"],["ext:车万符斗祭/test_1.jpg","die:ext:车万符斗祭/audio/die/test_1.mp3"]],
            reimu: ["female","fdj",4,["reimu_exterminate","reimu_clear","reimu_tribute","reimu_tribute2","ganjin"],["zhu","des:节操满地跑的城管 博丽灵梦 体力：4（画师：和茶，CV：shourei小N）","ext:车万符斗祭/image/figure/reimu.jpg","die:ext:车万符斗祭/audio/die/reimu.mp3"]],
            kaguya: ["female","fdj",3,["kaguya_dilemma","kaguya_inight","ganjin"],["des:永远的公主殿下 蓬莱山辉夜 体力：3。<br>（画师：噗呼噗呼@星の妄想乡，CV：shourei小N）","ext:车万符斗祭/image/figure/kaguya.jpg","die:ext:车万符斗祭/audio/die/kaguya.ogg"]],
            tenshi: ["female","fdj",3,["tenshi_masochist","tenshi_sp","ganjin"],["des:有顶天的大M子 比那名居天子 体力：3。（画师：月见，CV：VV）","ext:车万符斗祭/image/figure/tenshi.jpg","die:ext:车万符斗祭/audio/die/tenshi.mp3"]],
            koakuma: ["female","fdj",4,["koakuma_find","ganjin"],["des:图书管理员 小恶魔 体力：4。（画师：渚FUN/Takibi，CV：VV）","ext:车万符斗祭/image/figure/koakuma.jpg","die:ext:车万符斗祭/audio/die/koakuma.ogg"]],
            nazrin: ["female","fdj",3,["nazrin_treasurehunt","nazrin_agile","ganjin"],["des:探宝的小小大将 纳兹琳 体力：3。（画师：月见，CV：小羽）","ext:车万符斗祭/image/figure/nazrin.jpg","die:ext:车万符斗祭/audio/die/nazrin.mp3"]],
            shikieiki: ["female","fdj",3,["shikieiki_trial","shikieiki_majesty","ganjin"],["des:胸不平何以平天下 四季映姬 体力：3。（画师：和茶，CV：shourei小N）","ext:车万符斗祭/image/figure/shikieiki.jpg","die:ext:车万符斗祭/audio/die/shikieiki.mp3"]],
            medicine: ["female","fdj",3,["medicine_ciguatera","medicine_melancholy","ganjin"],["des:小小的甜蜜毒药 梅蒂欣 体力：3。（画师：和茶，CV：VV）","ext:车万符斗祭/image/figure/medicine.jpg","die:ext:车万符斗祭/audio/die/medicine.mp3"]],
            yuuka: ["female","fdj",4,["yuuka_rs","yuuka_sadist","ganjin"],["des:四季的鲜花之主 风见幽香 体力：4。（画师：霏茶，CV：VV）","ext:车万符斗祭/image/figure/yuuka.jpg","die:ext:车万符斗祭/audio/die/yuuka.mp3"]],
            tewi: ["female","fdj",4,["tewi_lucky","ganjin"],["des:幸运的腹黑兔子 因幡帝 体力：4。（画师：和茶，CV：北斗夜）","ext:车万符斗祭/image/figure/tewi.jpg","die:ext:车万符斗祭/audio/die/tewi.mp3"]],
            kogasa: ["female","fdj",3,["kogasa_surprise","kogasa_jolly","ganjin"],["des:愉快的遗忘之伞 多多良小伞 体力：3。（画师：霏茶，CV：VV）","ext:车万符斗祭/image/figure/kogasa.jpg","die:ext:车万符斗祭/audio/die/kogasa.ogg"]],
            patchouli: ["female","fdj",3,["patchouli_library","patchouli_knowledge","ganjin"],["des:不动的大图书馆 帕秋莉 体力：3。（画师：月见，CV：shourei小N）","ext:车万符斗祭/image/figure/patchouli.jpg","die:ext:车万符斗祭/audio/die/patchouli.mp3"]],
            youmu: ["female","fdj",4,["youmu_mjchz","youmu_nitoryuu","ganjin"],["des:半分虚幻的厨师 魂魄妖梦 体力：4。（画师：霏茶，CV：小羽）","ext:车万符斗祭/image/figure/youmu.jpg","die:ext:车万符斗祭/audio/die/youmu.ogg"]],
            yugi: ["female","fdj",4,["yugi_qiangxi","yugi_fp","ganjin"],["des:人所谈论的怪力乱神 星熊勇仪 体力：4。（画师：渚FUN，CV：北斗夜）","ext:车万符斗祭/image/figure/yugi.jpg","die:ext:车万符斗祭/audio/die/yugi.ogg"]],
            mokou: ["female","fdj",4,["mokou_reborn","mokou_ashes","ganjin"],["des:FFF团资深团员 藤原妹红 体力：4。（画师：六仔OwO，CV：小羽）","ext:车万符斗祭/image/figure/mokou.jpg","die:ext:车万符斗祭/audio/die/mokou.ogg"]],
            sanae: ["female","fdj",3,["sanae_miracle","sanae_faith","sanae_goddescendant","ganjin"],["des:常识满满的现人神 东风谷早苗 体力：3<br>（画师：小D@星の妄想乡，CV：VV）","ext:车万符斗祭/image/figure/sanae.jpg","die:ext:车万符斗祭/audio/die/sanae.ogg"]],
            spflan: ["female","fdj",4,["spflan_four","spflan_pohuai","ganjin"],["des:玩坏你哦 SP芙兰朵露 体力：4（画师：Vivicat@幻想梦斗符，CV：shourei小N）","ext:车万符斗祭/image/figure/spflan.jpg","die:ext:车万符斗祭/audio/die/spflan.ogg"]],
            ran: ["female","fdj",3,["ran_prophet","ran_ei","ran_suluo","ganjin"],["des:天河一号的核心 八云蓝 体力：3（画师：霏茶，CV：shourei小N）","ext:车万符斗祭/image/figure/ran.jpg","die:ext:车万符斗祭/audio/die/ran.ogg"]],
            rinnosuke: ["male","fdj",3,["rinnosuke_nitoru","rinnosuke_psycopath","ganjin"],["des:变态出没注意 森近霖之助 体力：3<br>（画师：霏茶，CV：大白）","ext:车万符斗祭/image/figure/rinnosuke.jpg","die:ext:车万符斗祭/audio/die/rinnosuke.ogg"]],
            cirno: ["female","fdj",4,["cirno_bakadesu","cirno_perfectfreeze","ganjin"],["des:跟青蛙过不去的笨蛋 琪露诺 体力：4（画师：渚FUN，CV：君寻）","ext:车万符斗祭/image/figure/cirno.jpg","die:ext:车万符斗祭/audio/die/cirno.ogg"]],
            eirin: ["female","fdj",3,["eirin_ts","eirin_medic","ganjin"],["des:伪月主谋 八意永琳 体力：3<br>（画师：渚FUN，CV：VV）","ext:车万符斗祭/image/figure/eirin.jpg","die:ext:车万符斗祭/audio/die/eirin.ogg"]],
            chen: ["female","fdj",4,["chen_skanda","chen_shikigami","ganjin"],["des:凶兆的黑喵 橙 体力：4（画师：和茶，CV：shourei小N）","ext:车万符斗祭/image/figure/chen.jpg","die:ext:车万符斗祭/audio/die/chen.ogg"]],
            parsee: ["female","fdj",4,["parsee_envy","ganjin"],["des:地壳下的嫉妒心 水桥帕露西 体力：4。（画师：和茶，CV：小羽）","ext:车万符斗祭/image/figure/parsee.jpg","die:ext:车万符斗祭/audio/die/parsee.ogg"]],
            nitori: ["female","fdj",3,["nitori_dismantle","nitori_craftsman","ganjin"],["des:水中的工程师 河城荷取 体力：3。（画师：和茶，CV：简翎）","ext:车万符斗祭/image/figure/nitori.jpg","die:ext:车万符斗祭/audio/die/nitori.mp3"]],
            remilia: ["female","fdj",4,["remilia_stg","remilia_vampirekiss","remilia_scarletmist","zhu1","ganjin"],["zhu","des:永远幼小的红月 蕾米莉亚 体力：4。（画师：小D@星の妄想乡，CV：VV）","ext:车万符斗祭/image/figure/remilia.jpg","die:ext:车万符斗祭/audio/die/remilia.ogg"]],
            meirin: ["female","fdj",4,["meirin_loongpunch","meirin_rb","ganjin","meirin_miss"],["des:我只打盹我不翘班 红美铃 体力：4。（画师：霏茶，CV：小羽）","ext:车万符斗祭/image/figure/meirin.jpg","die:ext:车万符斗祭/audio/die/die:false"]],
            sakuya: ["female","fdj",4,["sakuya_dagger","sakuya_lunadial","ganjin"],["des:完全潇洒的PAD长 十六夜咲夜 体力：4。（画师：和茶，CV：VV）","ext:车万符斗祭/image/figure/sakuya.jpg","die:ext:车万符斗祭/audio/die/sakuya.ogg"]],
            suika: ["female","fdj",4,["suika_heavydrinker","suika_drunkendream","ganjin"],["des:小小的酒鬼夜行 伊吹萃香 体力：4。（画师：和茶，CV：shourei小N）","ext:车万符斗祭/image/figure/suika.jpg","die:ext:车万符斗祭/audio/die/suika.ogg"]],
            marisa: ["female","fdj",4,["marisa_borrow","ganjin"],["des:绝非普通的强盗少女 雾雨魔理沙 体力：4。（画师：霏茶，CV：君寻）","ext:车万符斗祭/image/figure/marisa.jpg","die:ext:车万符斗祭/audio/die/marisa.ogg"]],
            aya: ["female","fdj",4,["aya_ultimatespeed","ganjin"],["des:幻想乡最速 射命丸文 体力：4。（画师：渚FUN，CV：君寻）","ext:车万符斗祭/image/figure/aya.jpg","die:ext:车万符斗祭/audio/die/aya.ogg"]],
            reisen: ["female","fdj",4,["reisen_lunatic","reisen_mahjongdrug","ganjin"],["des:永琳的首席药品品尝官 铃仙 体力：4。（画师：镜_Area@幻想梦斗符，CV：小羽）","ext:车万符斗祭/image/figure/reisen.jpg","die:ext:车万符斗祭/audio/die/reisen.ogg"]],
            "sp_aya": ["female","fdj",4,["sp_aya_jizou","sp_aya_fengmi","ganjin"],["des:剑圣是谁有我快吗 SP射命丸文 体力：4。（画师：躲猫，CV：君寻，人物设计：吹风姬）","ext:车万符斗祭/image/figure/sp_aya.jpg","die:ext:车万符斗祭/audio/die/sp_aya.mp3"]],
            kyouko: ["female","fdj",4,["kyouko_echo","kyouko_resonance","ganjin"],["des:诵经的山彦 幽谷响子 体力：4。（画师：月见，CV：小羽，人物设计：蝶之羽风暂留此）","ext:车万符斗祭/image/figure/kyouko.jpg","die:ext:车万符斗祭/audio/die/kyouko.ogg"]],
            kanako: ["female","fdj",4,["kanako_virtue","kanako_faith","ganjin"],["des:山丘与湖泊的化身 八坂神奈子 体力：4。（画师：和茶，CV：北斗夜/VV）","ext:车万符斗祭/image/figure/kanako.jpg","die:ext:车万符斗祭/audio/die/kanako.ogg"]],
            minoriko: ["female","fdj",3,["minoriko_foison","minoriko_autumnfeast","minoriko_akitribute","ganjin"],["des:没人气的丰收神 秋穰子 体力：3。（画师：和茶，CV：VV）","ext:车万符斗祭/image/figure/minoriko.jpg","die:ext:车万符斗祭/audio/die/minoriko.ogg"]],
            shizuha: ["female","fdj",3,["shizuha_decay","shizuha_autumnwind","ganjin"],["des:寂寞与终焉的象征 秋静叶 体力：3。（画师：和茶，CV：VV，人物设计：SmiteOfKing）","ext:车万符斗祭/image/figure/shizuha.jpg","die:ext:车万符斗祭/audio/die/shizuha.ogg"]],
            komachi: ["female","fdj",4,["komachi_riverside","komachi_awake","ganjin"],["des:乳不巨何以聚人心 小野塚小町 体力：4。（画师：渚FUN，CV：VV）","ext:车万符斗祭/image/figure/komachi.jpg","die:ext:车万符斗祭/audio/die/komachi.ogg"]],
            kokoro: ["female","fdj",3,["kokoro_hopemask","kokoro_darknoh","ganjin"],["des:表情丰富的扑克脸 秦心 体力：3。（画师：Takibi，CV：小羽/VV）","ext:车万符斗祭/image/figure/kokoro.jpg","die:ext:车万符斗祭/audio/die/kokoro.ogg"]],
            seija: ["female","fdj",3,["seija_incite","seija_reversal","ganjin"],["des:逆袭的天邪鬼 鬼人正邪 体力：3。（画师：霏茶，CV：北斗夜）","ext:车万符斗祭/image/figure/seija.jpg","die:ext:车万符斗祭/audio/die/seija.ogg"]],
            alice: ["female","fdj",4,["alice_dollblast","alice_legion","ganjin"],["des:七色的人偶使 爱丽丝 体力：4。（画师：霏茶，CV：小舞）","ext:车万符斗祭/image/figure/alice.jpg","die:ext:车万符斗祭/audio/die/alice.ogg"]],
            rumia: ["female","fdj",3,["rumia_darkness","rumia_cheat","ganjin"],["des:宵暗的妖怪 露米娅 体力：3。（画师：和茶，CV：小羽）","ext:车万符斗祭/image/figure/rumia.jpg","die:ext:车万符斗祭/audio/die/rumia.ogg"]],
            mamizou: ["female","fdj",4,["ganjin","mamizou_morph"],["des:大狸子 二岩猯藏 体力：4。（画师：hacko.@星の妄想乡，CV：shourei小N，人物设计：鵺子丶爱丽丝）","ext:车万符斗祭/image/figure/mamizou.jpg","die:ext:车万符斗祭/audio/die/mamizou.ogg"]],
            keine: ["female","fdj",4,["ganjin","keine_teach","keine_guard_awake"],["des:人间之里的守护者 上白泽慧音 体力：4。（画师：和茶，CV：银子）","ext:车万符斗祭/image/figure/keine.jpg","die:ext:车万符斗祭/audio/die/keine.ogg"]],
            yukari: ["female","fdj",4,["ganjin","yukari_spiritaway"],["des:永远17岁 八云紫 体力：4。（画师：Vivicat@幻想梦斗符，CV：VV）","ext:车万符斗祭/image/figure/yukari.jpg","die:ext:车万符斗祭/audio/die/yukari.ogg"]],
            momiji: ["female","fdj",4,["ganjin","momiji_disarm","momiji_sentry","momiji_solidshield"],["des:山中的千里眼 犬走椛 体力：4。（画师：和茶，CV：简翎）","ext:车万符斗祭/image/figure/momiji.jpg","die:ext:车万符斗祭/audio/die/momiji.ogg"]],
            mima: ["female","fdj",4,["ganjin","mima_tianyi","mima_eling"],["des:魔闪的修罗。designer：蝶之羽风暂留此'","ext:车万符斗祭/image/figure/mima.jpg","die:ext:车万符斗祭/audio/die/mima.mp3"]],
        },
        translate: {
            yuyuko: "西行寺幽幽子",
            daiyousei: "大妖精",
            flandre: "芙兰朵露",
            shinmyoumaru: "少名针妙丸",
            seiga: "霍青娥",
            "test_1": "测试武将",
            reimu: "博丽灵梦",
            kaguya: "蓬莱山辉夜",
            tenshi: "比那名居天子",
            koakuma: "小恶魔",
            nazrin: "纳兹琳",
            shikieiki: "四季映姬",
            medicine: "梅蒂欣",
            yuuka: "风见幽香",
            tewi: "因幡帝",
            kogasa: "多多良小伞",
            patchouli: "帕秋莉",
            youmu: "魂魄妖梦",
            yugi: "星熊勇仪",
            mokou: "藤原妹红",
            "车万符斗祭": "车万符斗祭",
            sanae: "东风谷早苗",
            spflan: "SP芙兰朵露",
            ran: "八云蓝",
            rinnosuke: "森近霖之助",
            cirno: "琪露诺",
            eirin: "八意永琳",
            chen: "橙",
            parsee: "水桥帕露西",
            nitori: "河城荷取",
            remilia: "蕾米莉亚",
            meirin: "红美铃",
            sakuya: "十六夜咲夜",
            suika: "伊吹萃香",
            marisa: "雾雨魔理沙",
            aya: "射命丸文",
            reisen: "铃仙",
            "sp_aya": "SP射命丸文",
            kyouko: "幽谷响子",
            kanako: "八坂神奈子",
            minoriko: "秋穰子",
            shizuha: "秋静叶",
            komachi: "小野冢小町",
            kokoro: "秦心",
            seija: "鬼人正邪",
            alice: "爱丽丝",
            rumia: "露米娅",
            mamizou: "二岩貒藏",
            keine: "上白泽慧音",
            yukari: "八云紫",
            momiji: "犬走椛",
            mima: "魅魔",
        },
    },
    card: {
        card: {
            "1": {
                type: "basic",
                discard: true,
                fullskin: true,
                toself: true,
                filterTarget: function(card,player,target){
                    return target == player;
                },
                enable: function(card,player){
                    return true;
                },
                selectTarget: -1,
                modTarget: true,
                content: function(){
                    "step 0"
                    target.chooseToDiscard('he',2,'请弃置2张牌，或受到1点无来源伤害。');
                    "step 1"
                    if(!result.bool) target.damage("nosource");
                },
                ai: {
                    order: 7.2,
                    useful: 4.5,
                    value: 9.2,
                    result: {
                        discard: 2,
                    },
                },
                vanish: true,
                derivation: "",
                image: "ext:车万符斗祭/image/card/1.png",
            },
            "card_sinsackhat": {
                image: "ext:车万符斗祭/image/card/card_sinsackhat.png",
                type: "equip",
                subtype: "equip2",
                skills: ["sinsackhat"],
                enable: true,
                ai: {
                    order: 9,
                    equipValue: function (card, player) {
                        if (get.position(card) == "e") return -8;
                        return 1;
                    },
                    value: function (card, player) {
                        if (player.getEquips(2).includes(card)) return -10;
                        return 2.5;
                    },
                    basic: {
                        equipValue: 5,
                        order: (card, player) => {
                            const equipValue = get.equipValue(card, player) / 20;
                            return player && player.hasSkillTag("reverseEquip") ? 8.5 - equipValue : 8 + equipValue;
                        },
                        useful: 2,
                        value: (card, player, index, method) => {
                            if (!player.getCards("e").includes(card) && !player.canEquip(card, true)) return 0.01;
                            const info = get.info(card),
                                current = player.getEquip(info.subtype),
                                value = current && card != current && get.value(current, player);
                            let equipValue = info.ai.equipValue || info.ai.basic.equipValue;
                            if (typeof equipValue == "function") {
                                if (method == "raw") return equipValue(card, player);
                                if (method == "raw2") return equipValue(card, player) - value;
                                return Math.max(0.1, equipValue(card, player) - value);
                            }
                            if (typeof equipValue != "number") equipValue = 0;
                            if (method == "raw") return equipValue;
                            if (method == "raw2") return equipValue - value;
                            return Math.max(0.1, equipValue - value);
                        },
                    },
                    result: {
                        keepAI: true,
                        target: function (player, target) {
                            var val = 2;
                            var val2 = 0;
                            var card = target.getEquip(2);
                            if (card) {
                                val2 = get.value(card, target);
                                if (val2 < 0) return 0;
                            }
                            return -val - val2;
                        },
                    },
                },
                selectTarget: 1,
                filterTarget: function (card, player, target) {
                    return target.canEquip(card, true) && get.distance(player,target) <= 2;
                },
                modTarget: true,
                allowMultiple: false,
                content: function () {
                    if (
                        !card?.cards.some(card => {
                            return get.position(card, true) !== "o";
                        })
                    ) {
                        target.equip(card);
                    }
                    //if (cards.length && get.position(cards[0], true) == "o") target.equip(cards[0]);
                },
                toself: false,
                fullskin: true,
            },
            "card_suwakohat": {
                fullskin: true,
                type: "equip",
                subtype: "equip5",
                skills: ["suwakohat"],
                ai: {
                    basic: {
                        equipValue: 9,
                        order: (card, player) => {
                            const equipValue = get.equipValue(card, player) / 20;
                            return player && player.hasSkillTag("reverseEquip") ? 8.5 - equipValue : 8 + equipValue;
                        },
                        useful: 2,
                        value: (card, player, index, method) => {
                            if (!player.getCards("e").includes(card) && !player.canEquip(card, true)) return 0.01;
                            const info = get.info(card),
                                current = player.getEquip(info.subtype),
                                value = current && card != current && get.value(current, player);
                            let equipValue = info.ai.equipValue || info.ai.basic.equipValue;
                            if (typeof equipValue == "function") {
                                if (method == "raw") return equipValue(card, player);
                                if (method == "raw2") return equipValue(card, player) - value;
                                return Math.max(0.1, equipValue(card, player) - value);
                            }
                            if (typeof equipValue != "number") equipValue = 0;
                            if (method == "raw") return equipValue;
                            if (method == "raw2") return equipValue - value;
                            return Math.max(0.1, equipValue - value);
                        },
                    },
                    result: {
                        target: (player, target, card) => get.equipResult(player, target, card),
                    },
                },
                image: "ext:车万符斗祭/image/card/card_suwakohat.png",
                enable: true,
                selectTarget: -1,
                filterTarget: (card, player, target) => player == target && target.canEquip(card, true),
                modTarget: true,
                allowMultiple: false,
                content: function () {
                    if (
                        !card?.cards.some(card => {
                            return get.position(card, true) !== "o";
                        })
                    ) {
                        target.equip(card);
                    }
                    //if (cards.length && get.position(cards[0], true) == "o") target.equip(cards[0]);
                },
                toself: true,
            },
            "card_ibukigourd": {
                fullskin: true,
                type: "equip",
                subtype: "equip4",
                skills: ["ibukigourd"],
                enable: true,
                selectTarget: -1,
                filterTarget: (card, player, target) => player == target && target.canEquip(card, true),
                modTarget: true,
                allowMultiple: false,
                content: function () {
                    if (
                        !card?.cards.some(card => {
                            return get.position(card, true) !== "o";
                        })
                    ) {
                        target.equip(card);
                        player.addSkill("hezui");
                        //player.addTempSkill("hezui", { player: "phaseBefore" });
                    game.log(player, "喝醉了。。。" );
                        //player.chooseUseTarget({ name: 'jiu', isCard: false}, true, false, 'nopopup','noanimate').set('logSkill','nolog');
                    }
                    //if (cards.length && get.position(cards[0], true) == "o") target.equip(cards[0]);
                },
                toself: true,
                image: "ext:车万符斗祭/image/card/card_ibukigourd.png",
                ai: {
                    basic: {
                        order: (card, player) => {
                            const equipValue = get.equipValue(card, player) / 20;
                            return player && player.hasSkillTag("reverseEquip") ? 8.5 - equipValue : 8 + equipValue;
                        },
                        useful: 3,
                        equipValue: 4.5,
                        value: (card, player, index, method) => {
                            if (!player.getCards("e").includes(card) && !player.canEquip(card, true)) return 0.01;
                            const info = get.info(card),
                                current = player.getEquip(info.subtype),
                                value = current && card != current && get.value(current, player);
                            let equipValue = info.ai.equipValue || info.ai.basic.equipValue;
                            if (typeof equipValue == "function") {
                                if (method == "raw") return equipValue(card, player);
                                if (method == "raw2") return equipValue(card, player) - value;
                                return Math.max(0.1, equipValue(card, player) - value);
                            }
                            if (typeof equipValue != "number") equipValue = 0;
                            if (method == "raw") return equipValue;
                            if (method == "raw2") return equipValue - value;
                            return Math.max(0.1, equipValue - value);
                        },
                    },
                    result: {
                        target: (player, target, card) => get.equipResult(player, target, card),
                    },
                },
            },
            "card_umbrella": {
                fullskin: true,
                type: "equip",
                subtype: "equip2",
                skills: ["umbrella"],
                image: "ext:车万符斗祭/image/card/card_umbrella.png",
                enable: true,
                selectTarget: -1,
                filterTarget: (card, player, target) => player == target && target.canEquip(card, true),
                modTarget: true,
                allowMultiple: false,
                content: function () {
                    if (
                        !card?.cards.some(card => {
                            return get.position(card, true) !== "o";
                        })
                    ) {
                        target.equip(card);
                    }
                    //if (cards.length && get.position(cards[0], true) == "o") target.equip(cards[0]);
                },
                toself: true,
                ai: {
                    basic: {
                        equipValue: 7.5,
                        order: (card, player) => {
                            const equipValue = get.equipValue(card, player) / 20;
                            return player && player.hasSkillTag('reverseEquip') ? 8.5 - equipValue : 8 + equipValue;
                        },
                        useful: 2,
                        value: (card, player, index, method) => {
                            if (!player.getCards('e').includes(card) && !player.canEquip(card, true)) return 0.01;
                            const info = get.info(card), current = player.getEquip(info.subtype), value = current && card != current && get.value(current, player);
                            let equipValue = info.ai.equipValue || info.ai.basic.equipValue;
                            if (typeof equipValue == 'function') {
                                if (method == 'raw') return equipValue(card, player);
                                if (method == 'raw2') return equipValue(card, player) - value;
                                return Math.max(0.1, equipValue(card, player) - value);
                            }
                            if (typeof equipValue != 'number') equipValue = 0;
                            if (method == 'raw') return equipValue;
                            if (method == 'raw2') return equipValue - value;
                            return Math.max(0.1, equipValue - value);
                        },
                    },
                    result: {
                        target: (player, target, card) => get.equipResult(player, target, card),
                    },
                },
            },
            "card_sealarray": {
                audio: "ext:车万符斗祭",
                fullskin: true,
                image: "ext:车万符斗祭/image/card/card_sealarray.png",
                type: "delay",
                filterTarget: function (card, player, target) {
                    //return lib.filter.judge(card, player, target) && 
                    return player != target;
                },
                judge: function (card) {
                    if (get.suit(card) == "heart") return 1;
                    return -2;
                },
                "judge2": function (result) {
                    if (result.bool == false) return true;
                    return false;
                },
                effect: function(){
                    if (result.bool == false){
                        lib.animate.skill['lebu'].call(player, 'lebu');
                        player.skip('phaseUse');
                    }
                },
                ai: {
                    basic: {
                        order: 1,
                        useful: function(card, i) {
                            let player = _status.event.player;
                            if (_status.event.isPhaseUsing()) return game.hasPlayer(cur => {
                                return (
                                    cur !== player &&
                                    lib.filter.judge(card, player, cur) &&
                                    get.effect(cur, card, player, player) > 0
                                );
                            }) ? 4.2 : 1;
                        },
                        value: 8,
                    },
                    result: {
                        ignoreStatus: true,
                        target: (player, target) => {
                            if (target === _status.currentPhase && target.skipList.includes("phaseUse")) {
                                let evt = _status.event.getParent("phase");
                                if (evt && evt.phaseList.indexOf("phaseJudge") <= evt.num) return 0;
                            }
                            let num = target.needsToDiscard(3),
                                cf = Math.pow(get.threaten(target, player), 2);
                            if (!num) return -0.01 * cf;
                            if (target.hp > 2) num--;
                            let dist = Math.sqrt(1 + get.distance(player, target, "absolute"));
                            if (dist < 1) dist = 1;
                            if (target.isTurnedOver()) dist++;
                            return (Math.min(-0.1, -num) * cf) / dist;
                        },
                    },
                    tag: {
                        skip: "phaseUse",
                    },
                },
                selectTarget: 1,
                enable: true,
                content: function () {
                    if (
                        !card?.cards.some(card => {
                            return get.position(card, true) !== "o";
                        })
                    ) {
                        target.addJudge(card, cards);
                    }
                },
                allowMultiple: false,
            },
            "card_houraijewel": {
                fullskin: true,
                image: "ext:车万符斗祭/image/card/card_houraijewel.png",
                type: "equip",
                subtype: "equip1",
                enable: true,
                selectTarget: -1,
                filterTarget: (card, player, target) => player == target && target.canEquip(card, true),
                skills: ["houraijewel"],
                modTarget: true,
                allowMultiple: false,
                content: function () {
                    if (
                        !card?.cards.some(card => {
                            return get.position(card, true) !== "o";
                        })
                    ) {
                        target.equip(card);
                    }
                    //if (cards.length && get.position(cards[0], true) == "o") target.equip(cards[0]);
                },
                toself: true,
                ai: {
                    basic: {
                        order: (card, player) => {
                            const equipValue = get.equipValue(card, player) / 20;
                            return player && player.hasSkillTag("reverseEquip") ? 8.5 - equipValue : 8 + equipValue;
                        },
                        useful: 7,
                        equipValue: 5,
                        value: (card, player, index, method) => {
                            if (!player.getCards("e").includes(card) && !player.canEquip(card, true)) return 0.01;
                            const info = get.info(card),
                                current = player.getEquip(info.subtype),
                                value = current && card != current && get.value(current, player);
                            let equipValue = info.ai.equipValue || info.ai.basic.equipValue;
                            if (typeof equipValue == "function") {
                                if (method == "raw") return equipValue(card, player);
                                if (method == "raw2") return equipValue(card, player) - value;
                                return Math.max(0.1, equipValue(card, player) - value);
                            }
                            if (typeof equipValue != "number") equipValue = 0;
                            if (method == "raw") return equipValue;
                            if (method == "raw2") return equipValue - value;
                            return Math.max(0.1, equipValue - value);
                        },
                    },
                    result: {
                        target: (player, target, card) => get.equipResult(player, target, card),
                    },
                },
            },
            houraitrick: {
                type: "trick",
                enable: true,
                filterTarget: function (card, player, target) {
                    return true;
                },
                content: function () {
                    target.damage(1);
                    game.log(player,"发动了",get.translation(card),"，包裹着魔法核心的弹幕冲向了",target,"。");
                    player.addTempSkill("弹幕补丁",'phaseJieshuBegin');
                },
                fullskin: true,
                image: "ext:车万符斗祭/houraitrick.png",
                selectTarget: 1,
            },
            "card_wine": {
                audio: "ext:车万符斗祭",
                fullskin: true,
                image: "ext:车万符斗祭/card_wine.png",
                type: "basic",
                enable: true,
                filterTarget: function (card, player, target) {
                    return target == player;
                },
                selectTarget: -1,
                modTarget: true,
                content: function () {
                    if (_status.currentPhase == target && _status.event.name != "phaseUse") {
                        var evt = event.getParent("phaseUse");
                        if (evt && evt.name == "phaseUse") {
                            evt.player.addSkill("hezui");
                            //evt.player.addTempSkill("hezui", { player: "phaseBefore" });
                            return;
                        }
                    }
                    target.addSkill("hezui");
                    //target.addTempSkill("hezui", { player: "phaseBefore" });
                },
                ai: {
                    basic: {
                        useful: (card, i) => {
                            if (_status.event.player.hp > 1) {
                                if (i === 0) return 4;
                                return 1;
                            }
                            if (i === 0) return 7.3;
                            return 3;
                        },
                        value: (card, player, i) => {
                            if (player.hp > 1) {
                                if (i === 0) return 5;
                                return 1;
                            }
                            if (i === 0) return 7.3;
                            return 3;
                        },
                    },
                    order: function(item, player) {
                        if (_status.event.dying) return 9;
                        let sha = get.order({ name: "sha" });
                        if (sha <= 0) return 0;
                        let usable = player.getCardUsable("sha");
                        if (
                            usable < 2 &&
                            player.hasCard(i => {
                                return get.name(i, player) == "zhuge";
                            }, "hs")
                        )
                            usable = Infinity;
                        let shas = Math.min(usable, player.mayHaveSha(player, "use", item, "count"));
                        if (shas != 1 || (lib.config.mode === "stone" && !player.isMin() && player.getActCount() + 1 >= player.actcount)) return 0;
                        return sha + 0.2;
                    },
                    result: {
                        target: (player, target, card) => {
                            if (target && target.isDying()) return 2;
                            if (!target || target._jiu_temp || !target.isPhaseUsing()) return 0;
                            let effs = { order: 0 },
                                temp;
                            target.getCards("hs", i => {
                                if (get.name(i) !== "sha" || ui.selected.cards.includes(i)) return false;
                                temp = get.order(i, target);
                                if (temp < effs.order) return false;
                                if (temp > effs.order) effs = { order: temp };
                                effs[i.cardid] = {
                                    card: i,
                                    target: null,
                                    eff: 0,
                                };
                            });
                            delete effs.order;
                            for (let i in effs) {
                                if (!lib.filter.filterCard(effs[i].card, target)) continue;
                                game.filterPlayer(current => {
                                    if (
                                        get.attitude(target, current) >= 0 ||
                                        !target.canUse(effs[i].card, current, null, true) ||
                                        current.hasSkillTag("filterDamage", null, {
                                            player: target,
                                            card: effs[i].card,
                                        })
                                    )
                                        return false;
                                    temp = get.effect(current, effs[i].card, target, player);
                                    if (temp <= effs[i].eff) return false;
                                    effs[i].target = current;
                                    effs[i].eff = temp;
                                    return false;
                                });
                                if (!effs[i].target) continue;
                                if (
                                    target.hasSkillTag(
                                        "directHit_ai",
                                        true,
                                        {
                                            target: effs[i].target,
                                            card: i,
                                        },
                                        true
                                    ) ||
                                    //(Math.min(target.getCardUsable("sha"), target.mayHaveSha(player, "use", item, "count")) === 1 && (
                                    target.needsToDiscard() > Math.max(0, 3 - target.hp) ||
                                    !effs[i].target.mayHaveShan(
                                        player,
                                        "use",
                                        effs[i].target.getCards(i => {
                                            return i.hasGaintag("sha_notshan");
                                        })
                                    )
                                    //))
                                ) {
                                    delete target._jiu_temp;
                                    return 1;
                                }
                            }
                            return 0;
                            var num = target.hp - target.hujia;
                                            if (num < 0) num = 0;
                                            if (target.hp > 3 || num > 1) return 0;
                                            if (target.hp <= 2 && num == 0) return 0;
                                            return 1;
                        },
                    },
                },
            },
            "card_sinsack": {
                audio: "ext:车万符斗祭",
                fullskin: true,
                type: "delay",
                cardnature: "none",
                modTarget: function(card, player, target) {
                    return lib.filter.judge(card, player, target);
                },
                enable: function(card,player){
                    return true;
                },
                filterTarget: function(card,player,target){
                    return player==target;
                },
                selectTarget: [-1,-1],
                toself: true,
                judge: function(card){
                    if(get.suit(card)=='spade'&&get.number(card)>0&&get.number(card)<9) return -5;
                    return 1;
                },
                "judge2": function(result){
                    if(result.bool==false) return true;
                    return false;
                },
                effect: function () {
                    if (result.bool == false) {
                        game.playAudio("../extension/车万符斗祭/",'card_sinsack_effect');
                        player.damage(3, 'nosource');
                        game.log(player,"被推倒了......");
                    } else {
                        player.addJudgeNext(card);
                    }
                },
                cancel: function(){
                    player.addJudgeNext(card);
                },
                ai: {
                    basic: {
                        useful: 0,
                        value: 0,
                    },
                    order: 1,
                    result: {
                        target: function(player, target) {
                            return lib.card.shandian.ai.result.target(player, target);
                        },
                    },
                },
                content: function () {
                        target.addJudge(card, cards);
                //if (lib.filter.judge(card, player, target) && cards.length && get.position(cards[0], true) == 'o') target.addJudge(card, cards);
                },
                allowMultiple: false,
                image: "ext:车万符斗祭/image/card/card_sinsack.png",
            },
            "danmaku_faith": {
                audio: "ext:车万符斗祭",
                image: "ext:车万符斗祭/danmaku_faith.png",
                fullskin: true,
                content: function() {
                    "step 0";
                    if (typeof event.shanRequired != "number" || !event.shanRequired || event.shanRequired < 0) {
                        event.shanRequired = 1;
                    }
                    if (typeof event.baseDamage != "number") event.baseDamage = 1;
                    if (typeof event.extraDamage != "number") event.extraDamage = 0;
                    "step 1";
                    if (event.directHit || event.directHit2 || (!_status.connectMode && lib.config.skip_shan && !target.hasShan())) {
                        event._result = { bool: false };
                    } else if (event.skipShan) {
                        event._result = { bool: true, result: "shaned" };
                    } else {
                        var next = target.chooseToUse("请使用一张闪响应杀");
                        next.set("type", "respondShan");
                        next.set("filterCard", function (card, player) {
                            if (get.name(card) != "shan") return false;
                            return lib.filter.cardEnabled(card, player, "forceEnable");
                        });
                        if (event.shanRequired > 1) {
                            next.set("prompt2", "（共需使用" + event.shanRequired + "张闪）");
                        } else if (game.hasNature(event.card, "stab")) {
                            next.set("prompt2", "（在此之后仍需弃置一张手牌）");
                        }
                        next.set("ai1", function (card) {
                            if (_status.event.useShan) return get.order(card);
                            return 0;
                        }).set("shanRequired", event.shanRequired);
                        next.set("respondTo", [player, card]);
                        next.set(
                            "useShan",
                            (() => {
                                if (target.hasSkillTag("noShan", null, event)) return false;
                                if (target.hasSkillTag("useShan", null, event)) return true;
                                if (target.isLinked() && game.hasNature(event.card) && get.attitude(target, player._trueMe || player) > 0) return false;
                                if (event.baseDamage + event.extraDamage <= 0 && !game.hasNature(event.card, "ice")) return false;
                                if (event.baseDamage + event.extraDamage >= target.hp + (player.hasSkillTag("jueqing", false, target) || target.hasSkill("gangzhi") ? target.hujia : 0)) return true;
                                if (!game.hasNature(event.card, "ice") && get.damageEffect(target, player, target, get.nature(event.card)) >= 0) return false;
                                if (event.shanRequired > 1 && target.mayHaveShan(target, "use", null, "count") < event.shanRequired - (event.shanIgnored || 0)) return false;
                                return true;
                            })()
                        );
                        //next.autochoose=lib.filter.autoRespondShan;
                    }
                    "step 2";
                    if (!result || !result.bool || !result.result || result.result != "shaned") {
                        event.trigger("shaHit");
                    } else {
                        event.shanRequired--;
                        if (event.shanRequired > 0) {
                            event.goto(1);
                        } else if (game.hasNature(event.card, "stab") && target.countCards("h") > 0) {
                            event.responded = result;
                            event.goto(4);
                        } else {
                            event.trigger("shaMiss");
                            event.responded = result;
                        }
                    }
                    "step 3";
                    if ((!result || !result.bool || !result.result || result.result != "shaned") && !event.unhurt) {
                        if (!event.directHit && !event.directHit2 && lib.filter.cardEnabled(new lib.element.VCard({ name: "shan" }), target, "forceEnable") && target.countCards("hs") > 0 && get.damageEffect(target, player, target) < 0) target.addGaintag(target.getCards("hs"), "sha_notshan");
                        target.damage(get.nature(event.card));
                        event.result = { bool: true };
                        event.trigger("shaDamage");
                    } else {
                        event.result = { bool: false };
                        event.trigger("shaUnhirt");
                    }
                    event.finish();
                    "step 4";
                    target.chooseToDiscard("刺杀：请弃置一张牌，否则此【杀】依然造成伤害").set("ai", function (card) {
                        var target = _status.event.player;
                        var evt = _status.event.getParent();
                        var bool = true;
                        if (get.damageEffect(target, evt.player, target, evt.card.nature) >= 0) bool = false;
                        if (bool) {
                            return 8 - get.useful(card);
                        }
                        return 0;
                    });
                    "step 5";
                    if ((!result || !result.bool) && !event.unhurt) {
                        target.damage(get.nature(event.card));
                        event.result = { bool: true };
                        event.trigger("shaDamage");
                        event.finish();
                    } else {
                        event.trigger("shaMiss");
                    }
                    "step 6";
                    if ((!result || !result.bool) && !event.unhurt) {
                        target.damage(get.nature(event.card));
                        event.result = { bool: true };
                        event.trigger("shaDamage");
                        event.finish();
                    } else {
                        event.result = { bool: false };
                        event.trigger("shaUnhirt");
                    }
                },
            },
            "card_donationbox": {
                audio: "ext:车万符斗祭",
                image: "ext:车万符斗祭/image/card/card_donationbox.png",
                fullimage: true,
                type: "trick",
                enable: true,
                targetprompt: ["赛钱","赛钱"],
                selectTarget: [1,2],
                filterTarget: function (card, player, target) {
                    return target != player && target.countCards("he") > 0;
                },
                content: function () {
                    "step 0"
                    //complexTarget: true,
                    target.chooseCard("交给" + get.translation(player) + "一张牌", true).ai = function (card) {
                        if (get.attitude(target, player) > 0) {
                            return 7 - get.value(card);
                        }
                        return 5 - get.value(card);
                    };
                    "step 1";
                    if (result.bool) {
                        target.$give(result.cards, player);
                        player.gain(result.cards, target);
                        target.lose(result.cards, ui.special);
                        player.addShownCards(result.cards, "visible_cards");
                        //target.showCards(result.cards);
                    }
                },
                ai: {
                    order: 9,
                    value: [4,1],
                    useful: 1,
                    result: {
                        target: function (player, target) {
                            var nh = target.countCards("he");
                            if (nh == 0) return 0;
                            if (nh == 1) return -0.1;
                            if (player.hasSkillTag("viewHandcard", null, target, true)) return -nh / 10;
                            return -1 / Math.sqrt(nh + 1);
                        },
                    },
                    tag: {
                        multitarget: 1,
                        multineg: 1,
                        loseCard: 1,
                        discard: 1,
                    },
                },
            },
            "card_exinwan": {
                fullskin: true,
                image: "ext:车万符斗祭/image/card/card_exinwan.png",
                type: "basic",
                enable: true,
                toself: true,
                modTarget: true,
                selectTarget: -1,
                filterTarget: function(card,player,target){
                    return target == player;
                },
                skill: ["skill_exinwan1"],
                content: function () {},
                ai: {
                    basic: {
                        order: 1,
                        useful: 1,
                        value: 5,
                    },
                    result: {
                        target: 1,
                    },
                    tag: {
                        draw: 1,
                        discard: 1,
                    },
                },
            },
        },
        translate: {
            "1": "1",
            "车万符斗祭": "车万符斗祭",
            "1_info": "基本牌。使用时，须弃置2张牌，否则受到1点无来源伤害。",
            "card_sinsackhat": "头套",
            "card_sinsackhat_info": "罪袋的头套<br>对距离2以内的一名角色使用。装备罪袋的头套的角色需在判定阶段后进行一次判定，若为黑桃1-8，则目标角色受到2点伤害，并且将罪袋的头套收入手牌。 <br>（画师：霏茶，CV：大白）",
            "card_suwakohat": "青蛙帽",
            "card_suwakohat_info": "青蛙帽  <br>装备后：手牌上限+2。  <br>（画师：霏茶，CV：VV）",
            "card_ibukigourd": "伊吹瓢",
            "card_ibukigourd_info": "伊吹瓢  <br>装备后：获得立即喝醉状态。并且，若你在出牌阶段没有造成过伤害，在回合结束阶段获得喝醉状态。  <br>（画师：霏茶）",
            "card_umbrella": "阳伞",
            "card_umbrella_info": "阳伞  <br>装备后：符卡效果造成的伤害对你无效。  <br>（画师：霏茶）",
            "card_sealarray": "封魔阵",
            "card_sealarray_info": "封魔阵  <br>延时类符卡。 <br>出牌阶段，对一名其他角色使用，将此牌横置于该角色的判定区内。该角色的判定阶段，需进行一次判定然后弃置此牌。若判定结果不为红桃，跳过其出牌阶段。 <br>>> 判定开始前,你可以使用【好人卡】抵消该符卡的效果（抵消后弃掉【封魔阵】）。  <br>（画师：霏茶，CV：shourei小N）",
            "card_houraijewel": "蓬莱玉枝",
            "card_houraijewel_info": "攻击范围1。<br>装备后，你使用的弹幕时，可以将弹幕的效果转化成如下的符卡效果：造成1点伤害。  <br>出牌阶段你可以消耗1点干劲重铸手牌中的武器  <br>（画师：霏茶）",
            houraitrick: "弹幕·蓬莱玉枝",
            "houraitrick_info": "",
            "card_wine": "酒",
            "card_wine_info": "出牌阶段，对自己使用。使用后获得喝醉状态。<br>喝醉状态下，使用【弹幕】造成的伤害+1，受到致命伤害时伤害-1。<br>>> 效果触发或者到了自己的准备阶段开始时须弃掉喝醉状态。<br>>> 你可以于喝醉状态下继续使用酒，但效果不叠加。<br>（画师：霏茶，CV：shourei小N）",
            "card_sinsack": "罪袋",
            "card_sinsack_info": "延时类符卡。 <br/>出牌阶段，对你使用，将此牌横置于你的判定区内。判定区内有此牌的角色的判定阶段，需进行一次判定： <br/>>> 若判定结果为黑桃1-8，则目标角色受到3点无来源伤害，然后将其置入弃牌堆。 <br/>>> 若判定结果不在此范围，则将其移动到下家的判定区内。 <br/>>> 判定开始前,你可以使用好人卡抵消该符卡的效果,并将该罪袋直接传递给下家。（画师：霏茶）",
            "danmaku_faith": "弹幕",
            "danmaku_faith_info": "出牌阶段，消耗1点干劲，对你攻击范围内的一名其他角色使用，对该角色造成1点伤害。 >> 默认情况下，你的攻击范围是1。 >> 干劲在出牌阶段开始时恢复成1点。  <br>（画师：霏茶，CV：VV）",
            "card_donationbox": "赛钱箱",
            "card_donationbox_info": "非延时符卡。<br>出牌阶段，对至多两名其他角色使用，目标角色需将自己的一张牌置入你的明牌区。<br>（画师：霏茶，CV：shourei小N）",
            "card_exinwan": "恶心丸",
            "card_exinwan_info": "（未完成）出牌阶段，对自己使用。使用时没有额外效果。当此牌以任意的方式进入弃牌堆时，引发弃牌动作的角色需选择其中一项执行： >> 受到1点无来源伤害。 >> 弃置两张牌。  ! 当你因为其他角色装备效果(如他人发动白楼剑特效）或技能效果（如正邪挑拨，秦心暗黑能乐）而将恶心丸主动置入弃牌堆时，恶心丸的弃置者视为该角色。  （画师：霏茶，CV：shourei小N）",
        },
        list: [["heart","2","card_sinsackhat"],["club","1","card_suwakohat"],["club","9","card_ibukigourd"],["club","2","card_umbrella"],["spade","9","card_sealarray"],["spade","10","card_sealarray"],["heart","10","card_sealarray"],["diamond","1","card_houraijewel"],["spade","1","card_donationbox"],["spade","10","card_donationbox"],["diamond","11","card_exinwan"],["club","12","card_exinwan"],["spade","1","card_sinsack"],["heart","1","card_sinsack"],["heart","2","card_sinsackhat"],["club","1","card_suwakohat"],["club","9","card_ibukigourd"],["club","2","card_umbrella"],["spade","9","card_sealarray"],["spade","10","card_sealarray"],["heart","10","card_sealarray"],["diamond","1","card_houraijewel"],["spade","1","card_donationbox"],["spade","10","card_donationbox"],["diamond","11","card_exinwan"],["club","12","card_exinwan"],["spade","1","card_sinsack"],["heart","1","card_sinsack"]],
    },
    skill: {
        skill: {
            "yuyuko_pcb": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                filterTarget: function(card,player,target){
                    return target!=player&&target.hp>0;
                },
                content: function(){
                    'step 0'
                    target.loseHp();
                    player.addSkill('yuyuko_pcb_recover');
                    player.markAuto('yuyuko_pcb_recover',[target]);
                    game.log(player,'将',target,'献祭给了西行妖。');
                },
                ai: {
                    order: 1,
                    expose: 3,
                    result: {
                        target: function(player,event,target) {
                            if (target.hp == 1 && get.attitude(player, event.player) > 0) return 5;
                            return 2;
                        },
                    },
                },
                group: ["yuyuko_pcb_unused"],
                subSkill: {
                    unused: {
                        trigger: {
                            player: "phaseEnd",
                        },
                        priority: 1,
                        direct: true,
                        audio: "ext:车万符斗祭:1",
                        filter: function(event,player){
                        return !player.getHistory('useSkill',evt=>evt.skill=='yuyuko_pcb').length;
                        },
                        content: function (){
                            "step 0"
                            if(typeof event.count!='number'){
                                // event.count=trigger.cards.length-1;
                                event.count=1;
                            }
                            var recover=0,lose=0,players=game.filterPlayer();
                            for(var i=0;i<players.length;i++){
                                if(players[i].hp<players[i].maxHp){
                                    if(get.attitude(player,players[i])>0){
                                        if(players[i].hp<2){
                                            lose--;
                                            recover+=0.5;
                                        }
                                        lose--;
                                        recover++;
                                    }
                                    else if(get.attitude(player,players[i])<0){
                                        if(players[i].hp<2){
                                            lose++;
                                            recover-=0.5;
                                        }
                                        lose++;
                                        recover--;
                                    }
                                }
                                else{
                                    if(get.attitude(player,players[i])>0){
                                        lose--;
                                    }
                                    else if(get.attitude(player,players[i])<0){
                                        lose++;
                                    }
                                }
                            }
                            var prompt=get.prompt('yuyuko_pcb_unused')+'（剩余'+get.cnNumber(event.count)+'次）';
                            "step 1"
                            player.logSkill('yuyuko_pcb_unused');
                                //event.bool=false;
                                event.num=0;
                                event.players=game.filterPlayer();
                            "step 2"
                            if(event.num<event.players.length){
                                var target=event.players[event.num];
                                if(target.hp<=1&&target!=player){
                                    target.loseHp();
                                }
                                event.num++;
                                event.redo();
                            }
                            "step 4"
                            if(event.count>1){
                                event.count--;
                                event.goto(0);
                            }
                        },
                        sub: true,
                        "_priority": -1,
                        sourceSkill: "yuyuko_pcb",
                    },
                    recover: {
                        audio: "ext:车万符斗祭:1",
                        trigger: {
                            player: "phaseJieshuBegin",
                        },
                        forced: true,
                        popup: true,
                        direct: false,
                        content: function(){
                            var targets=player.getStorage('yuyuko_pcb_recover');
                            for(var i=0;i<targets.length;i++){
                                if(targets[i].isAlive()){
                                    targets[i].recover();
                                }
                            }
                            game.log(player,'撤去了西行妖。',targets,'轻松了一点。');
                            delete player.storage.yuyuko_pcb_recover;
                            player.removeSkill('yuyuko_pcb_recover');
                        },
                        sub: true,
                        "_priority": -1,
                        sourceSkill: "yuyuko_pcb",
                    },
                },
                "_priority": 0,
            },
            "yuyuko_souldrain": {
                audio: "ext:车万符斗祭:1",
                filter: function(event,player){
                return event.player!=player&&_status.currentPhase&&_status.currentPhase==player;
                },
                direct: true,
                trigger: {
                    global: "dyingBegin",
                },
                logTarget: "player",
                content: function(){
                    'step 0'
                    player.logSkill('yuyuko_souldrain');
                    player.draw();
                    'step 1'
                    player.addTempSkill('yuyuko_souldrain_yuyuko_souldrain2');
                },
                subSkill: {
                    "yuyuko_souldrain2": {
                        audio: "ext:车万符斗祭:1",
                        trigger: {
                            global: "dying",
                        },
                        priority: 1,
                        filter: function (event,player){
                            return event.player!=player&&event.player.countCards('h')>0;
                        },
                        content: function (){
                            "step 0"
                            game.log(player,"微笑着站在一旁。",trigger.player,"似乎离死亡更近了一点。");
                            player.chooseToCompare(trigger.player);
                            "step 1"
                            if(result.bool){
                                trigger.player.maxHp=1;
                            }
                            else{
                                trigger.player.recover(1-trigger.player.hp)
                            }
                        },
                        ai: {
                            halfneg: true,
                            threaten: 3,
                            order: 10,
                            result: {
                                target: -1,
                            },
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "yuyuko_souldrain",
                    },
                },
                "_priority": 0,
            },
            "yuyuko_pcb_extract": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    global: "dieAfter",
                },
                forced: true,
                content: function(){
                    'step 0'
            var list=[
            '增加1点体力上限',
            '回复1点体力'
            ];
            player.chooseControl().set('choiceList',list).set('ai',function(){
            if(player.maxHp-player.hp<=1) return 0;
            return 1;
            });
            'step 1'
            if(result.index==0){
            player.gainMaxHp();
            }
            else{
            player.recover();
            }
                },
                group: "yuyuko_pcb_extract_maxhandcardchange",
                subSkill: {
                    maxhandcardchange: {
                        mod: {
                            maxHandcard: function (player, num) {
                                return player.maxHp;
                            },
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "yuyuko_pcb_extract",
                    },
                },
                "_priority": 0,
            },
            "daiyousei_support": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                filterCard: true,
                position: "he",
                selectCard: [1,Infinity],
                discard: false,
                prepare: "give",
                filterTarget: function (card, player, target) {
                    return player != target;
                },
                check: function (card) {
                    if (ui.selected.cards.length > 2) return 0;
                    if (ui.selected.cards.length && ui.selected.cards[0].name == "du") return 0;
                    if (!ui.selected.cards.length && card.name == "du") return 20;
                    var player = get.owner(card);
                    if (
                        player.hp == player.maxHp ||
                        player.storage.daiyousei_support < 0 ||
                        player.countCards("he") + player.storage.daiyousei_support <= 2
                    ) {
                        if (ui.selected.cards.length) {
                            return -1;
                        }
                        var players = game.filterPlayer();
                        for (var i = 0; i < players.length; i++) {
                            if (
                                players[i].hasSkill("haoshi") &&
                                !players[i].isTurnedOver() &&
                                !players[i].hasJudge("lebu") &&
                                get.attitude(player, players[i]) >= 3 &&
                                get.attitude(players[i], player) >= 3
                            ) {
                                return 11 - get.value(card);
                            }
                        }
                        if (player.countCards("he") > player.hp) return 10 - get.value(card);
                        if (player.countCards("he") > 2) return 6 - get.value(card);
                        return -1;
                    }
                    return 10 - get.value(card);
                },
                content: function () {
                    target.gain(cards, player);
                    if (typeof player.storage.daiyousei_support != "number") {
                        player.storage.daiyousei_support = 0;
                    }
                    if (player.storage.daiyousei_support >= 0) {
                        player.storage.daiyousei_support += cards.length;
                        if (player.storage.daiyousei_support >= 3) {
                            player.recover();
                            player.storage.daiyousei_support = -1;
                        }
                    }
                },
                ai: {
                    order: function (skill, player) {
                        if (
                            player.hp == player.maxHp ||
                            player.storage.daiyousei_support < 0 ||
                            player.countCards("he") + player.storage.daiyousei_support <= 2
                        ) {
                            return 1;
                        }
                        return 10;
                    },
                    result: {
                        target: function (player, target) {
                            if (ui.selected.cards.length && ui.selected.cards[0].name == "du") {
                                return -10;
                            }
                            if (target.hasJudge("lebu")) return 0;
                            var nh = target.countCards("he");
                            var np = player.countCards("he");
                            if (
                                player.hp == player.maxHp ||
                                player.storage.daiyousei_support < 0 ||
                                player.countCards("he") + player.storage.daiyousei_support <= 2
                            ) {
                                if (nh >= np - 1 && np <= player.hp && !target.hasSkill("haoshi")) return 0;
                            }
                            return Math.max(1, 5 - nh);
                        },
                    },
                    effect: {
                        target: function (card, player, target) {
                            if (player == target && get.type(card) == "equip") {
                                if (player.countCards("e", { subtype: get.subtype(card) })) {
                                    var players = game.filterPlayer();
                                    for (var i = 0; i < players.length; i++) {
                                        if (players[i] != player && get.attitude(player, players[i]) > 0) {
                                            return 0;
                                        }
                                    }
                                }
                            }
                        },
                    },
                    threaten: 0.8,
                },
                group: "daiyousei_support_0",
                subSkill: {
                    "0": {
                        trigger: {
                            player: "phaseUseBegin",
                        },
                        silent: true,
                        content: async function(event, trigger, player) {
                            player.storage.daiyousei_support = 0;
                        },
                        forced: true,
                        popup: false,
                        sub: true,
                        sourceSkill: "daiyousei_support",
                        "_priority": 1,
                    },
                },
                "_priority": 0,
            },
            "daiyousei_moe": {
                audio: "ext:车万符斗祭:1",
                forced: true,
                trigger: {
                    player: "phaseDrawBegin2",
                },
                filter: function(event, player) {
                return !event.numFixed;
                },
                content: function() {
                trigger.num += player.getDamagedHp();
                        var chat = ['卖了个萌'].randomGet();
                        player.say(chat);
                        game.log(player,"用手扯开脸颊，向大家做了一个夸张的笑脸，摸了",trigger.num,"张牌跑开了~");
                },
                "_priority": 0,
            },
            "seiga_heterodoxy": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                filter: function (event, player) {
                    var players = event.seiga_heterodoxy;
                    if (!players || !players.length) return false;
                    var source = player.storage.seiga_heterodoxy_effect;
                    return get.itemtype(source) != "player" || !source.isIn();
                },
                "heterodoxy_wrapKey": function () {
                    var str = "";
                    for (var arg of arguments) {
                        if (arg === null || arg === undefined) {
                            str += arg + "-";
                            continue;
                        }
                        switch (get.itemtype(arg)) {
                            case "player":
                                str += "p:" + arg.playerid;
                                break;
                            case "card":
                                if (arg.cardid) {
                                    str += "c:" + arg.cardid;
                                } else {
                                    str += "c:" + arg.name;
                                }
                                break;
                            default:
                                str += "n:" + arg;
                                break;
                        }
                        str += "-";
                    }
                    return str;
                },
                "heterodoxy_effect": function (target, card, player, viewer) {
                    if (!_status.event) return get.effect(target, card, player, viewer);
                    var key = lib.skill.seiga_heterodoxy.heterodoxy_wrapKey.apply(null, arguments);
                    var effect = _status.event.getTempCache("effect", key);
                    if (effect !== undefined) return effect;
                    effect = get.effect(target, card, player, viewer);
                    _status.event.putTempCache("effect", key, effect);
                    return effect;
                },
                "heterodoxy_canUse": function (player, card, target, arg1, arg2) {
                    if (!_status.event) return player.canUse(card, target, arg1, arg2);
                    var key = lib.skill.seiga_heterodoxy.heterodoxy_wrapKey.apply(null, arguments);
                    var effect = _status.event.getTempCache("canUse", key);
                    if (effect !== undefined) return effect;
                    effect = player.canUse(card, target, arg1, arg2);
                    _status.event.putTempCache("canUse", key, effect);
                    return effect;
                },
                "heterodoxy_effect_use": function (target, card, player, viewer) {
                    if (!_status.event) return get.effect_use(target, card, player, viewer);
                    var key = lib.skill.seiga_heterodoxy.heterodoxy_wrapKey.apply(null, arguments);
                    var effect = _status.event.getTempCache("effect_use", key);
                    if (effect !== undefined) return effect;
                    effect = get.effect_use(target, card, player, viewer);
                    _status.event.putTempCache("effect_use", key, effect);
                    return effect;
                },
                onChooseToUse: function (event) {
                    if (!game.online && event.type == "phase" && !event.seiga_heterodoxy) {
                        var players = game.filterPlayer(function (current) {
                            return current != event.player;
                        });
                        event.set("seiga_heterodoxy",players);
                    }
                },
                filterTarget: function (card, player, target) {
                    var players = _status.event.seiga_heterodoxy;
                    if (!players || !players.length) return false;
                    return players.includes(target);
                },
                content: function () {
                    if (target.isIn()) {
                        player.storage.seiga_heterodoxy_effect = target;
                        player.addTempSkill("seiga_heterodoxy_effect", "phaseUseAfter");
                    }
                },
                ai: {
                    threaten: 4,
                    order: 12,
                    result: {
                        player: function (player, target) {
                            return player.getCards("hs").reduce(function (eff, card) {
                                return Math.max(eff, lib.skill.seiga_heterodoxy.getUseValue(card, target, player) - lib.skill.seiga_heterodoxy.getUseValue(card, player, player));
                            }, 0);
                        },
                    },
                },
                getUseValue: function (card, player, viewer) {
                    if (typeof card == "string") {
                        card = { name: card, isCard: true };
                    }
                    var key = lib.skill.seiga_heterodoxy.heterodoxy_wrapKey(card, player, viewer);
                    if (_status.event) {
                        var uv = _status.event.getTempCache("getUseValue", key);
                        if (uv !== undefined) {
                            return uv;
                        }
                    }
                    var targets = game.filterPlayer();
                    var value = [];
                    var min = 0;
                    var info = get.info(card);
                    if (!info || info.notarget) {
                        if (_status.event) {
                            _status.event.putTempCache("getUseValue", key, 0);
                        }
                        return 0;
                    }
                    var range;
                    var select = get.copy(info.selectTarget);
                    if (select == undefined) {
                        if (info.filterTarget == undefined) {
                            if (_status.event) {
                                _status.event.putTempCache("getUseValue", key, true);
                            }
                            return true;
                        }
                        range = [1, 1];
                    } else if (typeof select == "number") range = [select, select];
                    else if (get.itemtype(select) == "select") range = select;
                    else if (typeof select == "function") range = select(card, player);
                    if (info.singleCard) range = [1, 1];
                    game.checkMod(card, player, range, "selectTarget", player);
                    if (!range) {
                        if (_status.event) {
                            _status.event.putTempCache("getUseValue", key, 0);
                        }
                        return 0;
                    }
                    for (var i = 0; i < targets.length; i++) {
                        if (lib.skill.seiga_heterodoxy.heterodoxy_canUse(player, card, targets[i], null, true)) {
                            var eff = lib.skill.seiga_heterodoxy.heterodoxy_effect(targets[i], card, player, viewer);
                            value.push(eff);
                        }
                    }
                    value.sort(function (a, b) {
                        return b - a;
                    });
                    for (var i = 0; i < value.length; i++) {
                        if (i == range[1] || (range[1] != -1 && value[i] <= 0)) break;
                        min += value[i];
                    }
                    if (_status.event) {
                        _status.event.putTempCache("getUseValue", key, min);
                    }
                    return min;
                },
                subSkill: {
                    effect: {
                        charlotte: true,
                        priority: null,
                        onremove: true,
                        mark: "character",
                        intro: {
                            content: "下一张牌视为由$使用",
                        },
                        trigger: {
                            player: "useCardBefore",
                        },
                        forced: true,
                        filter: function (event, player) {
                            var source = player.storage.seiga_heterodoxy_effect;
                            return get.itemtype(source) == "player"&&source.isIn();
                        },
                        logTarget: (event, player) => player.storage.seiga_heterodoxy_effect,
                        content: function () {
                            "step 0"
                            trigger.player = player.storage.seiga_heterodoxy_effect;
                            trigger.noai = true;
                            "step 1"
                            if(((trigger.card.name == "sha")&&player.storage.ganjin != 0)&&!player.getEquip('zhuge','rewrite_zhuge')){player.storage.ganjin -= 1;}
                            else 0;
                            player.update();
                            if((trigger.card&&get.type(trigger.card)=='trick')&&trigger.targets.length >= 2){player.chooseBool(`是否跳过此次群体符卡的结算？`, get.attitude(player, trigger.player) < 0);}
                            else event.goto(3);
                            "step 2"
                            if (result.bool) {
                                trigger.targets.remove(player);
                        }
                            "step 3"
                            trigger.targets.sortBySeat(trigger.player);
                            player.removeSkill("seiga_heterodoxy_effect");
                            game.delay(0.5);
                        },
                        ai: {
                            order: function (card, player, target, current) {
                                if (typeof card != "object") return;
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                return [0, lib.skill.seiga_heterodoxy.heterodoxy_effect_use(target, card, source, player), 0, lib.skill.seiga_heterodoxy.heterodoxy_effect(target, card, source, target)];
                            },
                        },
                        mod: {
                            selectCard: function (card, player, range) {
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                var range,
                                    info = get.info(card);
                                var select = get.copy(info.selectTarget);
                                if (select == undefined) {
                                    if (info.filterTarget == undefined) return [0, 0];
                                    range = [1, 1];    
                                } else if (typeof select == "number") range = [select, select];
                                else if (get.itemtype(select) == "select") range = select;
                                else if (typeof select == "function") range = select(card, source);
                                game.checkMod(card, source, range, "selectTarget", source);
                            },
                            "cardEnabled2": function (card, player, event) {
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                var check = game.checkMod(card, source, event, "unchanged", "cardEnabled2", source);
                                return check;
                            },
                            cardEnabled: function (card, player, event) {
                        if (card.name == "sha"&&(player.storage.ganjin==0)&&!player.getEquip('zhuge','rewrite_zhuge')) return false;
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                if (event === "forceEnable") {
                                    var mod = game.checkMod(card, source, event, "unchanged", "cardEnabled", source);
                                    if (mod != "unchanged") return mod;
                                    return true;
                                } else {
                                    var filter = get.info(card).enable;
                                    if (!filter) return;
                                    var mod = game.checkMod(card, player, source, "unchanged", "cardEnabled", source);
                                    if (mod != "unchanged") return mod;
                                    if (typeof filter == "boolean") return filter;
                                    if (typeof filter == "function") return filter(card, source, event);
                                }
                            },
                            cardUsable: function (card, player, num) {
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                var event = _status.event;
                                if (event.type == "chooseToUse_button") event = event.getParent();
                                if (source != _status.event.player) return true;
                                if (info.updateUsable == "phaseUse") {
                                    if (event.getParent().name != "phaseUse") return true;
                                    if (event.getParent().player != source) return true;
                                }
                                event.addCount_extra = true;
                                var num = info.usable;
                                if (typeof num == "function") num = num(card, source);
                                num = game.checkMod(card, source, num, event, "cardUsable", source);
                                if (typeof num != "number") return true;
                                if (source.countUsed(card) < num) return true;
                                if (
                                    game.hasPlayer(function (current) {
                                        return game.checkMod(card, source, current, false, "cardUsableTarget", source);
                                    })
                                ) {
                                    return true;
                                }
                                return false;
                            },
                            playerEnabled: function (card, player, target) {
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                return lib.filter.targetEnabledx(card, source, target);
                            },
                            targetInRange: function (card, player, target) {
                                var source = player.storage.seiga_heterodoxy_effect;
                                if (!source.isIn() || get.itemtype(source) != "player" || get.itemtype(source.storage.seiga_heterodoxy_effect) == "player") return;
                                return lib.filter.targetInRange(card, source, target);
                            },
                        },
                        sub: true,
                        sourceSkill: "seiga_heterodoxy",
                        "_priority": null,
                    },
                },
                "_priority": 0,
            },
            "flandre_csd": {
                forced: true,
                shaRelated: true,
                juedouRelated: true,
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "useCardToTargeted",
                },
                check: function(event,player){
                    return get.attitude(player,event.target)<=0;
                },
                filter: function(event,player){
                    return event.card.name=='sha'||event.card.name=='juedou';
                },
                logTarget: "target",
                content: function(){
                        trigger.target.addTempSkill('flandre_csd_block', 'phaseEnd');
                },
                subSkill: {
                    block: {
                        init: function(player, skill) {
                        player.addSkillBlocker(skill);
                        },
                        onremove: function(player, skill) {
                        player.removeSkillBlocker(skill);
                        },
                        charlotte: true,
                        locked: true,
                        skillBlocker: function(skill,player){
                        return skill != 'flandre_csd_block' && !lib.skill[skill].charlotte;
                        },
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/flandre_exterminate.png >",
                        intro: {
                            name: "毁灭",
                            content: "你被芙兰玩坏了，本回合所有技能失效",
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "flandre_csd",
                    },
                },
                "_priority": 0,
            },
            ganjin: {
                trigger: {
                    player: "phaseZhunbeiAfter",
                },
                supercharlotte: true,
                charlotte: true,
                fixed: true,
                direct: true,
                change: function (player, num) {
                    if (!player.storage.ganjin) player.storage.ganjin = 0;
                    if (!num) return;
                    player.storage.ganjin = 1;
                    player.markSkill("ganjin");
                },
                content: function () {
                    lib.skill.ganjin.change(player, 1);
                    game.log(player,'获得了一点干劲。');
                },
                onremove: true,
                mod: {
                    cardUsable: function (card,player,num){
                        if(card.name=='sha'&&(player.storage.ganjin==0)&&!player.getEquip('zhuge','rewrite_zhuge')) return 0;
                        return Infinity;
                    },
                },
                group: ["ganjin_hejiu","ganjin_yanhui","ganjin_chongzhu","ganjin_shaAfter","ganjin_tired","ganjin_zhuSkill","upgrade","startx"],
                subSkill: {
                    hejiu: {
                        mod: {
                            cardname: function (card, player, name) {
                                if ('jiu'.includes(card.name)) return 'card_wine';
                                if ('lebu'.includes(card.name)) return 'card_sealarray';
                            },
                        },
                        trigger: {
                            player: "useCard",
                        },
                        direct: true,
                        filter: function (event, player) {
                            if (_status.currentPhase != player) return false;
                            return event.card.name == 'card_wine' && event.cards && event.cards.length == 1 && 'jiu'.includes(event.cards[0].name);
                        },
                        content: function () { },
                        ai: {
                            result: {
                                target: (player, target, card) => {
                                    if (!target.hasSkill('hezui')) return 2;
                                    let usable = target.getCardUsable("sha");
                                    if (
                                        !usable ||
                                        (!player.isMin() &&
                                            player.getActCount() + 1 >= player.actcount) ||
                                        !target.mayHaveSha(player, "use", card)
                                    )
                                        return 0;
                                },
                            },
                            order: 4,
                        },
                        sub: true,
                        sourceSkill: "ganjin",
                        "_priority": 6,
                        "audioname2": {
                            "key_shiki": "shiki_omusubi",
                        },
                    },
                    yanhui: {
                        filter: function (event, player) {
                            return event.card.name == "taoyuan";
                        },
                        trigger: {
                            target: "useCardToTargeted",
                        },
                        direct: true,
                        content: function () {
                            if (player.hp == player.maxHp){
                                trigger.getParent().excluded.add(player);
                                //player.chooseUseTarget({ name: 'jiu'}, true, false, 'nopopup','noanimate').set('logSkill','nolog');
                                player.addSkill('hezui');
                                game.log(player, "喝醉了。。。" );
                            }
                                else event.finish();
                        },
                        sub: true,
                        sourceSkill: "ganjin",
                        "_priority": -20,
                        "audioname2": {
                            "key_shiki": "shiki_omusubi",
                        },
                    },
                    chongzhu: {
                        trigger: {
                            player: "equipBefore",
                        },
                        filter: function (event,player) {
                            return get.subtype(event.card) == 'equip1' && player.storage.ganjin != 0;
                        },
                        direct: true,
                        content: function () {
                            "step 0"
                            var equipValue = get.equipValue(trigger.card, player);
                            player
                            .chooseControl("重铸", "继续装备")
                            .set("prompt", "装备" + get.translation(trigger.card))
                            .set("prompt2","你即将装备" + get.translation(trigger.card) + "，是否重铸该武器并失去一点干劲？")
                                 //"是否重铸" + get.translation(trigger.card) + "？或者继续装备" + get.translation(trigger.card)+ "." + "当前值：" + equipValue + "\n")
                            .set("ai", function () {
                                var player = _status.event.player;
                                var trigger = _status.event.getTrigger();
                                if (get.equipValue(trigger.card, player) > 1) return "继续装备";
                               return "重铸";
                            });
                            "step 1"
                            if (result.control == "重铸") {
                                if(player.hasSkill("aya_ultimatespeed")){
                                    player.addMark("aya_ultimatespeed",-1);
                                    //修复文文重铸武器计入使用问题
                                }
                                var card = trigger.card;
                                player.recast(card);
                                trigger.cancel();
                                player.storage.ganjin -= 1;
                                game.log(player,'失去了一点干劲。');
                                if(player.storage.ganjin == 0){
                                    player.addSkill("ganjin_tired");
                                }
                            } else {
                                event.finish();    
                            }
                        },
                        sub: true,
                        sourceSkill: "ganjin",
                        "_priority": 0,
                        "audioname2": {
                            "key_shiki": "shiki_omusubi",
                        },
                    },
                    shaAfter: {
                        direct: true,
                        trigger: {
                            player: ["useCard1"],
                        },
                        filter: function (event, player) {
                    return _status.currentPhase == player && event.card.name == 'sha';
                        },
                        content: function () {
                            if(_status.currentPhase == player&&(player.storage.ganjin != 0)&&!player.getEquip('zhuge','rewrite_zhuge')){
                                player.storage.ganjin -= 1;
                                game.log(player,'失去了一点干劲。');
                                }
                            if(player.storage.ganjin == 0){
                                player.addSkill("ganjin_tired");
                            }
                        },
                        sub: true,
                        sourceSkill: "ganjin",
                        "_priority": 0,
                        "audioname2": {
                            "key_shiki": "shiki_omusubi",
                        },
                    },
                    tired: {
                        trigger: {
                            player: ["phaseUseBegin","phaseEnd"],
                        },
                        popup: false,
                        filter: function (event, player) {
                            return player.hasSkill("ganjin_tired");
                        },
                        charlotte: true,
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/attacked.png >",
                        intro: {
                            content: "没有干劲了。。。",
                        },
                        forced: true,
                        content: function(){
                                player.removeSkill("ganjin_tired");
                        },
                        sub: true,
                        sourceSkill: "ganjin",
                        "_priority": 0,
                        "audioname2": {
                            "key_shiki": "shiki_omusubi",
                        },
                    },
                    zhuSkill: {
                        trigger: {
                            global: "gameDrawBefore",
                        },
                        direct: true,
                        filter: function (event, player) {
                            return player.identity == 'zhu'&& game.players.length >= 4;
                        },
                        content: function () {
                            "step 0"
                            var list=["boss_tongchou","boss_xieli","boss_xisheng","boss_yingyuan"];
                            player.chooseControl(list).set("prompt","选择并获得一项BOSS技：").set("ai",function(){
                                return list.randomGet();
                            });
                            "step 1"
                            if(result.control == "boss_tongchou"){
                                player.addSkill("boss_tongchou");
                                game.log(player,"获得了BOSS技【","boss_tongchou","】")
                            }
                            else if(result.control == "boss_xieli"){
                                player.addSkill("boss_xieli");
                                game.log(player,"获得了BOSS技【","boss_xieli","】")
                            }
                            else if (result.control == "boss_xisheng"){
                                player.addSkill("boss_xisheng");
                                game.log(player,"获得了BOSS技【","boss_xisheng","】")
                            }
                            else {
                                player.addSkill("boss_yingyuan");
                                game.log(player,"获得了BOSS技【","boss_yingyuan","】")
                            }
                            "step 2"
                            //早苗防冲突
                            //if(player.name=="sanae"){
                           //     player.removeSkill("ganjin_yanhui");
                           // }
                        },
                        sub: true,
                        sourceSkill: "ganjin",
                        "_priority": 0,
                        "audioname2": {
                            "key_shiki": "shiki_omusubi",
                        },
                    },
                },
                "_priority": 0,
            },
            "干劲描述": {
                "_priority": 0,
            },
            "flandre_cs": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseDrawBegin2",
                },
                check: function(event,player){
                    if(player.skipList.includes('phaseUse')||player.countCards('h')<3) return false;
                    if(!player.hasSha()) return false;
                    return game.hasPlayer(current=>get.attitude(player,current)<0&&player.canUse('sha',current));
                },
                preHidden: true,
                filter: function(event,player){
                    return !event.numFixed&&event.num>0;
                },
                content: async function(event,trigger,player){
                    player.addTempSkill('flandre_cs_1','phaseJieshuBegin');
                    trigger.num--;
                },
                "_priority": 0,
            },
            "flandre_cs_1": {
                mod: {
                    cardUsable: function (card, player, num) {
                      if (card.name == 'sha') return Infinity;
                    },
                },
                trigger: {
                    source: "damageBegin1",
                },
                filter: function(event){
                    return event.card&&(event.card.name=='sha'||event.card.name=='juedou')&&event.notLink();
                },
                direct: true,
                content: async function(event,trigger,player){
                    trigger.num++;
                },
                ai: {
                    damageBonus: true,
                },
                skillBlocker: function(skill,player){
                return skill != 'flandre_cs' && !lib.skill[skill].charlotte;
                },
                mark: true,
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/flandrecs.png >",
                intro: {
                    name: "狂咲",
                    content: "玩坏你哦",
                },
                group: "flandre_cs_1_targetsha",
                subSkill: {
                    targetsha: {
                        forced: true,
                        trigger: {
                            player: ["shaAfter","shaMiss"],
                        },
                        "prompt2": "当你使用【杀】指定一名角色为目标后，你本回合内不能再对其使用【杀】",
                        filter: function(event,player){
                        return event.card.name=='sha'&&event.target.countGainableCards(player,'he');
                        },
                        check: function(event,player){
                        return get.effect(event.target,{name:'guohe_copy2'},player,player)>0;
                        },
                        logTarget: "target",
                        content: function(){
                        player.addTempSkill('flandre_cs_1_blocksha');
                        player.markAuto('flandre_cs_1_blocksha',[trigger.target]);
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "flandre_cs_1",
                    },
                    blocksha: {
                        charlotte: true,
                        onremove: true,
                        marktext: "<img style=width:16px src=extension/车万符斗祭/image/tag/flandrecs_1.png >",
                        intro: {
                            content: "不能对$使用【杀】（装备连弩时除外）",
                        },
                        mod: {
                            playerEnabled: function(card,player,target){
                            if(player.getStorage('flandre_cs_1_blocksha').includes(target)&&get.name(card)=='sha'&&!player.getEquip('zhuge','rewrite_zhuge')) return false;
                            },
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "flandre_cs_1",
                    },
                },
                "_priority": 0,
            },
            "flan_sword": {
                unique: true,
                mod: {
                    selectTarget: function (card,player,range){
                            //你的普通杀视为火杀
                            if(card.name=='sha'&&!card.nature)card.nature='fire'; 
                    },
                },
                trigger: {
                    source: "damageBegin3",
                },
                filter: function(event,player){
                    var target=event.player&&event.source.hasSkillTag("noDirectDamage");
                    return event.card;
                },
                direct: true,
                logTarget: "player",
                content: function(){
                    'step 0'
                        trigger.num += 1;
                    'step 1'
                    if(player.isHealthy()){
                        player.loseHp(trigger.num);      
                        }
                    else player.loseHp((player.hp)-1); 
                    'step 2'
                    player.recover(trigger.num);
                },
                group: "flan_sword_draw",
                subSkill: {
                    draw: {
                        trigger: {
                            target: "useCardToTargeted",
                        },
                        direct: true,
                        content: function(){
                        if(player.getDamagedHp() > player.countCards('e')){player.draw(player.getDamagedHp()-player.countCards('e'));
                                                                          player.chooseToDiscard('he',true);}
                        else player.draw();
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "flan_sword",
                    },
                },
                "_priority": 0,
            },
            "flan_awake": {
                audio: "flandre_cs",
                unique: true,
                derivation: "flan_sword",
                trigger: {
                    player: "dying",
                },
                juexingji: true,
                forced: true,
                skillAnimation: false,
                content: function(){
                'step 0'
                if(game.roundNumber>player.maxHp){
                    player.removeSkill('flandre_cs');
                }
                player.awakenSkill('flan_awake');
                'step 1'
                player.draw(game.roundNumber);
                'step 2'
                if(game.roundNumber<player.maxHp){
                    player.recover(Math.max(1-player.hp,player.maxHp-player.hp-game.roundNumber));
                }
                else player.recover(1-player.hp);
                'step 3'
                player.addSkills('flan_sword');
                },
                "_priority": 0,
                "Fool_skillColor": "DarkRed",
            },
            "shinmyoumaru_mallet": {
                audio: "ext:车万符斗祭:2",
                direct: true,
                trigger: {
                    global: "judge",
                },
                filter: function (event, player) {
                    return player.countCards("he") > 0;
                },
                logTarget: "player",
                content: function(){
                    "step 0";
                    player
                        .chooseCard(get.translation(trigger.player) + "的" + (trigger.judgestr || "") + "判定为" + get.translation(trigger.player.judging[0]) + "，" + get.prompt("shinmyoumaru_mallet"), "he", function (card) {
                        var num0 = _status.event.judging.number;
                            if (num0 == -1) { return false;}
                            else if (get.number(card) > num0) { return true;}
                                return false;
                        })
                        .set("ai", function (card) {
                            var trigger = _status.event.getTrigger();
                            var player = _status.event.player;
                            var judging = _status.event.judging;
                            var result = trigger.judge(card) - trigger.judge(judging);
                            var attitude = get.attitude(player, trigger.player);
                            if (attitude == 0 || result == 0) return 0;
                            if (attitude > 0) {
                                return result;
                            } else {
                                return -result;
                            }
                        })
                        .set("judging", trigger.player.judging[0],"noanimate");
                    "step 1";
                    if (result.bool) {
                        player.respond(result.cards, "highlight");
                    } else {
                        event.finish();
                    }
                    "step 2";
                    if (result.bool) {
                        player.logSkill("shinmyoumaru_mallet");
                        player.$gain2(trigger.player.judging[0]);
                        player.gain(trigger.player.judging[0]);
                        trigger.player.judging[0] = result.cards[0];
                        if (!get.owner(result.cards[0], "judge")) {
                            trigger.position.appendChild(result.cards[0]);
                        }
                        game.log(trigger.player, "的判定牌改为", result.cards[0]);
                    }
                    "step 3";
                    game.delay(2);
                },
                ai: {
                    tag: {
                        rejudge: 1,
                    },
                },
                "_priority": 0,
            },
            "seiga_extend": {
                skillAnimation: false,
                trigger: {
                    global: "dieAfter",
                },
                filter: function(event,player){
                return _status.currentPhase&&_status.currentPhase==player;
                },
                logTarget: "player",
                content: function(){
                'step 0'
                var list=[];
                var listm=[];
                var listv=[];
                if(trigger.player.name1!=undefined) listm=lib.character[trigger.player.name1][3];
                else listm=lib.character[trigger.player.name][3];
                if(trigger.player.name2!=undefined) listv=lib.character[trigger.player.name2][3];
                listm=listm.concat(listv);
                var func=function(skill){
                    var info=get.info(skill);
                    if(!info||info.charlotte||info.hiddenSkill||info.zhuSkill||info.juexingji||info.limited||info.dutySkill||(info.unique&&!info.gainable)||lib.skill.drlt_duorui.bannedList.includes(skill)) return false;
                    return true;
                };
                for(var i=0;i<listm.length;i++){
                    if(func(listm[i])) list.add(listm[i]);
                }
                event.skills=list;
                'step 1'
                if(event.skills.length>0){
                    player.chooseControl(event.skills).set('prompt','请选择要获得的技能').set('ai',function(){return event.skills.randomGet()});
                }
                else event.finish();
                'step 2'
                player.addTempSkills(result.control,{player:'dieAfter'});
                // player.popup(result.control,'thunder');
                player.storage.drlt_duorui=[result.control];
                player.storage.drlt_duorui_player=trigger.player;
                trigger.player.storage.drlt_duorui=[result.control];
                trigger.player.addTempSkill('drlt_duorui1',{player:'phaseAfter'});
                // game.log(player,'获得了技能','#g【'+get.translation(result.control)+'】')
            'step 3'
            player.awakenSkill('seiga_extend');
                },
                "_priority": 0,
                "Fool_skillColor": "DarkRed",
            },
            "seiga_daotai_max": {
                audio: "seiga_daotai",
                trigger: {
                    global: "phaseBegin",
                },
                forced: true,
                filter: function (event, player) {
                    return event.player != player && !player.getEquip(2);
                },
                content: function () {
                    player.changeHujia(1, null, true);
                    player.addSkill("seiga_daotai_max_lose");
                },
                subSkill: {
                    lose: {
                        audio: "seiga_daotai_lose",
                        trigger: {
                            player: ["phaseUseBegin","damageEnd"],
                        },
                        filter: function (event, player) {
                            return event.player == player;
                        },
                        forced: true,
                        content: function () {
                                    "step 0"
                                    player.recover(player.hujia);
                                    player.draw(player.hujia);
                                    "step 1"
                                    if(_status.currentPhase == player){
                                        player.loseHp();
                                    }
                                    player.changeHujia(-player.hujia);
                                    "step 2"
                                    player.removeSkill("seiga_daotai_max_lose");
                        },
                        sub: true,
                        sourceSkill: "seiga_daotai_max",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "seiga_daotai": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    global: "phaseBegin",
                },
                forced: true,
                filter: function (event, player) {
                    return event.player != player && !player.getEquip(2);
                },
                content: function () {
                    if(player.hujia<player.maxHp){
                    player.changeHujia(1, null, true);
                    }
                    if(player.hp == player.maxHp){
                        player.loseHp();
                            }
                    player.addSkill("seiga_daotai_lose");
                },
                subSkill: {
                    lose: {
                        audio: "ext:车万符斗祭:1",
                        trigger: {
                            player: ["phaseBegin","damageEnd"],
                        },
                        filter: function (event, player) {
                            return event.player == player;
                        },
                        forced: true,
                        content: function () {
                                    "step 0"
                                    if(_status.currentPhase != player && (player.hujia >= player.hp || player.hujia >= (game.countPlayer()-1))){
                                        player.draw(player.hujia);
                                    }
                                    "step 1"
                                    if(_status.currentPhase == player&&player.hp == player.maxHp){
                                        player.storage.ganjin -= 1;
                                    }
                                    if(_status.currentPhase == player&&player.hp < player.maxHp){
                                        player.draw(player.hujia);
                                        if(player.hujia > 0){
                                            player.discardPlayerCard(player,player.hujia,'hej',true);
                                            }
                                    }
                                    player.changeHujia(-player.hujia);
                                    "step 2"
                                    player.removeSkill("seiga_daotai_lose");
                        },
                        sub: true,
                        sourceSkill: "seiga_daotai",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "reimu_exterminate_active": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    global: "phaseJieshuBegin",
                },
                direct: true,
                priority: 15,
                filter: function(event,player){
                    if(event.source==player&&_status.currentPhase==player) return false; 
                    return event.player!=player&&event.player.getStat('damage')>0; 
                },
                logTarget: ()=>_status.currentPhase,
                content: function (){
                  player.chooseToUse(function(card,player,event){ 
                        if(get.name(card)!='sha') return false; 
                        return lib.filter.filterCard.apply(this,arguments); 
                    },'是否对'+get.translation(_status.currentPhase)+'使用一张弹幕？').set('complexSelect',true).set('logSkill','reimu_exterminate_active').set('filterTarget',function(card,player,target){ 
                        if(target!=_status.event.sourcex&&!ui.selected.targets.contains(_status.event.sourcex)) return false; 
                        return lib.filter.targetEnabled.apply(this,arguments); 
                    }).set('sourcex',_status.currentPhase); 
                },
                "_priority": 1500,
            },
            "reimu_clear": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    source: "damageSource",
                },
                check: function (event, player) { 
                    return get.attitude(player, event.player) < 0 &&player!=_status.currentPhase;
                    return get.attitude(player, event.player) >= 0 &&player==_status.currentPhase ||player.countCards("h") <= 2;
                },
                filter: function(event,player){
                return event.player.isIn()&&event.player!=player
                },
                content: function () {
                    "step 0" 
                    player.draw();
                    trigger.player.draw();
                    "step 1"
                    if(player!=_status.currentPhase){
                        "step 0"
                        var cards = Array.from(ui.ordering.childNodes);
                        while (cards.length) {
                            cards.shift().discard();
                        }
                        "step 1"
                        var evt = _status.event.getParent("phaseUse");
                        if (evt) {
                            game.resetSkills();
                            _status.event = evt;
                            _status.event.finish();
                            _status.event.untrigger(true);
                        }
                        game.log("异变解决了，",player,"邀请了",trigger.player,"一起去参加宴会。");
                    } 
                },
                ai: {
                    halfneg: true,
                    basic: {
                        order: 4,
                        useful: 5,
                        value: 1,
                    },
                    tag: {
                        draw: 1,
                    },
                },
            },
            "reimu_tribute": {
                unique: true,
                audio: "ext:车万符斗祭:2",
                global: "reimu_tribute_good",
                zhuSkill: true,
                trigger: {
                    global: "gameStart",
                    player: "enterGame",
                },
                Yx: true,
                direct: true,
                filter: function (event, player) {
                    return player.identity == 'zhu';
                },
                content: function () {
                    player.removeSkill("ganjin_zhuSkill");
                },
                "_priority": 0,
            },
            "reimu_tribute_good": {
                enable: "phaseUse",
                discard: false,
                lose: false,
                delay: false,
                line: true,
                prepare: function(cards,player,targets){
                    targets[0].logSkill('reimu_tribute');
                },
                prompt: function(){
                    var player=_status.event.player;
                    var list=game.filterPlayer(function(target){
                        return target!=player&&target.hasZhuSkill('reimu_tribute',player);
                    });
                    var str='将一张手牌交给'+get.translation(list)+'：灵梦充满期待的目光看向你......';
                    if(list.length>1) str+='中的一人';
                    return str;
                },
                filter: function(event,player){
                    if(!game.hasPlayer(function(target){
                        return target!=player&&target.hasZhuSkill('reimu_tribute',player)&&!target.hasSkill('reimu_tribute_ok')&&target.countCards('h')<target.maxHp;
                    })) return false;
                    return player.hasCard(function(card){
                        return lib.skill.reimu_tribute_good.filterCard(card,player);
                    },'h');
                },
                filterCard: function(card,player){
                    return get.name(card,player)!='card_exinwan';
                },
                log: false,
                visible: true,
                filterTarget: function(card,player,target){
                    return target!=player&&target.hasZhuSkill('reimu_tribute',player)&&!target.hasSkill('reimu_tribute_ok');
                },
                content: function(){
                    player.give(cards,target);
                    target.addTempSkill('reimu_tribute_ok','phaseUseEnd');
                    target.addShownCards(cards,"visible_cards");
                },
                ai: {
                    expose: 0.3,
                    order: 1,
                    result: {
                        target: 5,
                    },
                },
                "_priority": 0,
            },
            "reimu_tribute2": {
                unique: true,
                audio: "ext:车万符斗祭:1",
                global: "reimu_tribute_bad",
                zhuSkill: true,
                "_priority": 0,
            },
            "reimu_tribute_bad": {
                enable: "phaseUse",
                discard: false,
                lose: false,
                delay: false,
                line: true,
                prepare: function(cards,player,targets){
                    targets[0].logSkill('reimu_tribute2');
                },
                prompt: function(){
                    var player=_status.event.player;
                    var list=game.filterPlayer(function(target){
                        return target!=player&&target.hasZhuSkill('reimu_tribute2',player);
                    });
                    var str='将一张恶心丸交给'+get.translation(list)+'：喂！赛钱箱不是垃圾桶啦！';
                    if(list.length>1) str+='中的一人';
                    return str;
                },
                filter: function(event,player){
                    if(!game.hasPlayer(function(target){
                        return target!=player&&target.hasZhuSkill('reimu_tribute',player)&&!target.hasSkill('reimu_tribute_ok')&&target.countCards('h')<target.maxHp;
                    })) return false;
                    return player.hasCard(function(card){
                        return lib.skill.reimu_tribute_bad.filterCard(card,player);
                    },'h');
                },
                filterCard: function(card,player){
                    return get.name(card,player)=='card_exinwan';
                },
                log: false,
                visible: true,
                filterTarget: function(card,player,target){
                    return target!=player&&target.hasZhuSkill('reimu_tribute2',player)&&!target.hasSkill('reimu_tribute_ok');
                },
                content: function(){
                    player.give(cards,target);
                    target.addTempSkill('reimu_tribute_ok','phaseUseEnd');
                    target.addShownCards(cards,"visible_cards");
                },
                ai: {
                    order: 8,
                    result: {
                        target: -1,
                    },
                },
                "_priority": 0,
            },
            "visible_cards": {
                "_priority": 0,
            },
            "reimu_tribute_ok": {
                "_priority": 0,
            },
            "reimu_exterminate": {
                audio: "reimu_exterminate_active",
                group: ["reimu_exterminate_active","reimu_exterminate_damage"],
                "_priority": 0,
            },
            "reimu_saisen": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "useCardToPlayered",
                },
                logTarget: "target",
                filter: function (event, player) {
                    if(event.target == player || (event.card.name !='sha'& event.card.name != 'juedou')) return false; 
                    return event.target.hp >= player.hp;
                },
                forced: true,
                preHidden: true,
                content: function () {
                    "step 0"
                    trigger.target.choosePlayerCard(trigger.target, 'hej', '选择一张牌交给' + get.translation(player) + '，或点“取消”此牌无法被响应').set('ai',function(button){
                        if (trigger.target.countCards('j') == 0 || trigger.target.countCards('h', 'shan') == 0){
                        return false; 
                        }
                        else get.attitude(_status.event.player,_status.event.target);
                    }).set('target',trigger.target);
                    "step 1"
                    if (result.bool) {
                        trigger.target.give(result.cards, player);
                        player.draw();
                    }
                    else {
                        trigger.getParent().directHit.push(trigger.target);
                        player.recover();
                        player.draw();
                    }
                },
                ai: {
                    "maixie_defend": true,
                    skillTagFilter: function (player, tag, arg) {
                        if(event.target == player || event.card.name != 'sha') return false; 
                        return arg.target.hp > player.hp;
                    },
                },
                "_priority": 0,
            },
            "reimu_damage": {
                mod: {
                    targetInRange: function(card){
                        if(card.name=='sha') return true;
                    },
                    maxHandcardBase: function(player){
                        return Math.max(player.hp,game.countPlayer());
                    },
                },
                locked: true,
                trigger: {
                    player: "useCard",
                },
                direct: true,
                content: function(){
                    player.draw();
                    if(player.maxHp<=2){
                        trigger.baseDamage+=game.roundNumber;
                        player.addTempSkill("reimu_damage_2");
                    }
                    else {
                        player.maxHp--;
                        player.update();
                    }
                },
                subSkill: {
                    "2": {
                        trigger: {
                            player: "phaseEnd",
                        },
                        frequent: true,
                        filter: function (event, player) {
                            return event.player == player;
                          },
                        content: function () {
                            "step 0"
                            player.damage(player.countUsed());
                        },
                        sub: true,
                        sourceSkill: "reimu_damage",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "reimu_awake": {
                audio: "ext:车万符斗祭:1",
                derivation: "reimu_damage",
                trigger: {
                    global: "gameStart",
                    player: "enterGame",
                },
                juexingji: true,
                forced: true,
                skillAnimation: false,
                filter: function (event, player) {
                    return game.hasPlayer(function (current) {
                        return current.group == "shen";
                    });
                },
                content: function () {
                    'step 0'
                    player.awakenSkill('reimu_awake');
                    player.maxHp = 7;
                    'step 1'
                    player.addSkill('reimu_damage');
                },
                "_priority": 0,
                "Fool_skillColor": "DarkGray",
            },
            "reimu_extra": {
                derivation: "reimu_saisen",
                trigger: {
                    global: ["gainAfter","loseAsyncAfter"],
                },
                filter: function (event, player) {
                    return game.hasPlayer(function (current) {
                        return current.isPhaseUsing() && event.player != player && event.getg(current).length > 0 && current.countCards('h') > player.countCards('e') + 7;
                    });
                },
                juexingji: true,
                forced: true,
                skillAnimation: false,
                content: function () {
                    'step 0'
                    player.awakenSkill('reimu_extra');
                    'step 1'
                    player.addSkill('reimu_saisen');
                },
                "_priority": 0,
                "Fool_skillColor": "DarkGray",
            },
            "kaguya_dilemma": {
                audio: "ext:车万符斗祭:1",
                locked: true,
                group: ["kaguya_dilemma_good","kaguya_dilemma_bad"],
                "_priority": 0,
            },
            "kaguya_dilemma_good": {
                audio: "kaguya_dilemma",
                trigger: {
                    player: "recoverEnd",
                },
                logTarget: "source",
                filter: function (event, player) {
                    return event.source && event.source.isIn();
                },
                content: function () {
                    "step 0";
                    event.num = trigger.num;
                    "step 1";
                    if (event.num > 0) {
                        trigger.source.draw();
                        event.num--;
                        event.redo();
                    }
                },
                "_priority": 0,
            },
            "kaguya_dilemma_bad": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageEnd",
                },
                filter: function (event, player) {
                    return event.source && event.source != player && event.source.isIn();
                },
                logTarget: "source",
                content: function () {
                    "step 0";
                    trigger.source
                        .chooseCard("选择一张方片牌交给" + get.translation(player) + "，或点“取消”失去1点体力", function (card) {
                            return get.suit(card) == "diamond";
                        })
                        .set("ai", function (card) {
                            var player = _status.event.getParent().player,
                                source = _status.event.player;
                            if (get.effect(source, { name: "losehp" }, source, source) >= 0) return 0;
                            if (get.attitude(player, source) > 0) return 11 - get.value(card);
                            return 7 - get.value(card);
                        });
                    "step 1";
                    if (result.bool) {
                        trigger.source.give(result.cards, player);
                    } else {
                        trigger.source.loseHp();
                    }
                },
                ai: {
                    "maixie_defend": true,
                    effect: {
                        target: function (card, player, target) {
                            if (player.hasSkillTag("jueqing", false, target)) return [1, -2];
                            if (!target.hasFriend()) return;
                            if (get.tag(card, "damage")) return [1, 0, 0, -1];
                        },
                    },
                },
                "_priority": 0,
            },
            "kaguya_inight": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    global: "useCardAfter",
                },
                direct: true,
                popup: false,
                filter: function(event, player) {
                    return event.player != player
                      && _status.currentPhase != player&& get.color(event.card, event.player) == 'red'&& get.type(event.card) == 'basic' &&player.countCards("hes", { color: "red" }) > 0;
                  },
                content: function(){
                    "step 0"
                    player.addTempSkill("kaguya_inight_lebu");
                    player.chooseToUse({
                      logSkill: event.name,
                      preTarget: trigger.player,
                      position:"he",
                      prompt: `是否将一张红色基本牌或装备牌当【封魔阵】对${get.translation(trigger.player)}使用？`,
                        filterCard: function (card, player) {
                        return get.name(card) == 'card_sealarray' && lib.filter.filterCard.apply(this, arguments);
                      },
                      filterTarget: function (card, player, target) {
                        return target == _status.event.preTarget && lib.filter.targetEnabled.apply(this, arguments);
                      },
                      addCount: false,
                    });
                    "step 1"
                    if (!result.bool) {
                      event.finish();
                      return;
                    }
                },
                ai: {
                    basic: {
                        order: 1,
                        useful: 1,
                        value: 8,
                    },
                },
                subSkill: {
                    lebu: {
                        audio: "kaguya_inight",
                        enable: "chooseToUse",
                        filterCard: function(card){
                            return get.color(card) == "red"&& get.type(card) != "trick";
                        },
                        position: "hes",
                        viewAs: {
                            name: "card_sealarray",
                        },
                        sub: true,
                        sourceSkill: "kaguya_inight",
                        "_priority": 0,
                        ai: {
                            basic: {
                                order: 1,
                                useful: 1,
                                value: 8,
                            },
                            result: {
                                ignoreStatus: true,
                                target: (player, target) => {
                                    if (target === _status.currentPhase && target.skipList.includes("phaseUse")) {
                                        let evt = _status.event.getParent("phase");
                                        if (evt && evt.phaseList.indexOf("phaseJudge") <= evt.num) return 0;
                                    }
                                    let num = target.needsToDiscard(3),
                                        cf = Math.pow(get.threaten(target, player), 2);
                                    if (!num) return -0.01 * cf;
                                    if (target.hp > 2) num--;
                                    let dist = Math.sqrt(1 + get.distance(player, target, "absolute"));
                                    if (dist < 1) dist = 1;
                                    if (target.isTurnedOver()) dist++;
                                    return (Math.min(-0.1, -num) * cf) / dist;
                                },
                            },
                            tag: {
                                skip: "phaseUse",
                            },
                        },
                    },
                },
                "_priority": 0,
            },
            "tenshi_masochist": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageEnd",
                },
                filter: function(event){
                    return event.num>0;
                },
                content: async function(event,trigger,player){
                    event.count=1;
                    // event.goto -> while
                    while(true){
                        event.count--;
                        const {cards}=await
                        game.cardsGotoOrdering(get.cards(trigger.num*2));
                        if(_status.connectMode) game.broadcastAll(function()
            {_status.noclearcountdown=true});
                        event.given_map={};
                        if(!cards.length) return;
                        // event.goto -> do while
                        do{
                            const {result:{bool,links}} =
                                  cards.length==1?
                                  {result:{links:cards.slice(0),bool: true}}:
                            await player.chooseCardButton('请选择要分配的牌',true,cards,[1,cards.length]).set('ai',()=>{
                                if(ui.selected.buttons.length==0) return 1;
                                return 0;
                            });
                            if(!bool) return;
                            cards.removeArray(links);
                            event.togive=links.slice(0);
                            const {result:{targets}}=await player.chooseTarget('选择一名角色获得'+get.translation(links),true).set('ai',target=>{
                                const att=get.attitude(_status.event.player,target);
                                if(_status.event.enemy){
                                    return -att;
                                }
                                else if(att>0){
                                    return att/(1+target.countCards('h'));
                                }
                                else{
                                    return att/100;
                                }
                            }).set('enemy',get.value(event.togive[0],player,'raw')<0);
                            if(targets.length){
                                const id=targets[0].playerid,
                                      map=event.given_map;
                                if(!map[id]) map[id]=[];
                                map[id].addArray(event.togive);
                            }
                        }
                        while(cards.length>0);
                        if(_status.connectMode){
                            game.broadcastAll(function(){
                                delete _status.noclearcountdown;game.stopCountChoose()});
                        }
                        const list=[];
                        for(const i in event.given_map){
                            const source=(_status.connectMode?lib.playerOL:game.playerMap)[i];
                            player.line(source,'green');
                            if(player!==source&&(get.mode()!=='identity'||player.identity!=='nei')) player.addExpose(0.2);
                            list.push([source, event.given_map[i]]);
                        }
                        game.loseAsync({
                            gain_list:list,
                            giver:player,
                            animate:'draw',
                        }).setContent('gaincardMultiple');
                        if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name, player)){
                            const {
                                result:{bool:chooseBoolResultBool}}=await player.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name);
                            if(chooseBoolResultBool) player.logSkill(event.name);
                            else return;
                        }
                        else return;
                    }
                },
                ai: {
                    maixie: true,
                    "maixie_hp": true,
                    effect: {
                        target: function(card,player,target){
                            if(get.tag(card,'damage')){
                                if(player.hasSkillTag('jueqing',false,target)) return [1,-2];
                                if(!target.hasFriend()) return;
                                let num=1;
                                if(get.attitude(player,target)>0){
                                    if(player.needsToDiscard()) num=0.7;
                                    else num=0.5;
                                }
                                if(target.hp>=4) return [1,num*2];
                                if(target.hp==3) return [1,num*1.5];
                                if(target.hp==2) return [1,num*0.5];
                            }
                        },
                    },
                },
                "_priority": 0,
            },
            "tenshi_sp": {
                audio: "ext:车万符斗祭:1",
                forced: true,
                trigger: {
                    global: "judgeEnd",
                },
                filter: function (event, player){
                    return get.color(event.result.card) == 'red' && get.distance(player, event.player) <= 1;
                },
                content: function () {
                    var card = trigger.result.card;
                    trigger.player.$give(card, player); 
                    player.gain(card, 'gain2'); 
                },
                "_priority": 0,
            },
            "koakuma_find": {
                audio: "ext:车万符斗祭:1",
                mod: {
                    aiOrder: function(player, card, num) {
                        if(num<=0||get.itemtype(card)!=='card'||get.type(card)!=='equip') return num;
                        let eq=player.getEquip(get.subtype(card));
                        if(eq&&get.equipValue(card)-get.equipValue(eq)<Math.max(1.2,6-player.hp)) return 0;
                    },
                },
                locked: false,
                enable: "phaseUse",
                usable: 1,
                position: "he",
                filterCard: true,
                selectCard: [1,8],
                prompt: "弃置至多X张牌并摸等量的牌（X为场上存活人数）",
                check: function(card){
                    return 6-get.value(card)
                },
                content: async function(event,trigger,player){
                    player.draw(event.cards.length);
                },
                ai: {
                    order: 1,
                    result: {
                        player: 1,
                    },
                    threaten: 1.5,
                },
                "_priority": 0,
            },
            "nazrin_treasurehunt": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseZhunbeiBegin",
                },
                frequent: false,
                content: function(){
                    'step 0'
                    var next=player.judge(function(card){
                        if(get.color(card)=='black') return 1;
                        return -1;
                    });
                    next.set('callback',function(){
                        if(event.judgeResult.color=='black') player.gain(card,'gain2');
                    });
                    'step 1'
                    if(result.judge>0) player.chooseBool('是否再次发动【探宝】？').set(event.name);
                    else event.finish();
                    'step 2'
                    if(result.bool) event.goto(0);
                },
                "_priority": 0,
            },
            "nazrin_agile": {
                audio: "ext:车万符斗祭:1",
                mod: {
                    aiValue: function (player, card, num) {
                        if (get.name(card) != "shan" && get.color(card) != "black")
                            return;
                        var cards = player.getCards("hs", function (card) {
                            return get.name(card) == "shan" || get.color(card) == "black";
                        });
                        cards.sort(function (a, b) {
                            return (get.name(b) == "shan" ? 1 : 2) - (get.name(a) == "shan" ? 1 : 2);
                        });
                        var geti = function () {
                            if (cards.includes(card)) {
                                return cards.indexOf(card);
                            }
                            return cards.length;
                        };
                        if (get.name(card) == "shan") 
                            return Math.min(num, [6, 4, 3][Math.min(geti(), 2)]) * 0.6;
                        return Math.max(num, [6.5, 4, 3][Math.min(geti(), 2)]);
                    },
                    aiUseful: function () {
                        return lib.skill.reqingguo.mod.aiValue.apply(this, arguments);
                    },
                },
                locked: false,
                enable: ["chooseToRespond","chooseToUse"],
                filterCard: function (card) {
                    return get.color(card) == "black";
                },
                position: "hs",
                viewAs: {
                    name: "shan",
                },
                viewAsFilter: function (player) {
                    if (!player.countCards("hs", { color: "black" })) 
                        return false;
                },
                prompt: "将一张黑色牌当闪打出",
                check: function () {
                    return 1;
                },
                ai: {
                    order: 2,
                    respondShan: true,
                    skillTagFilter: function (player) {
                        if (!player.countCards("hs", { color: "black" })) return false;
                    },
                    effect: {
                        target: function (card, player, target, current) {
                            if (get.tag(card, "respondShan") && current < 0) return 0.6;
                        },
                    },
                    basic: {
                        useful: (card, i) => {
                            let player = _status.event.player,
                                basic = [7, 5.1, 2],
                                num = basic[Math.min(2, i)];
                            if (player.hp > 2 && player.hasSkillTag("maixie")) num *= 0.57;
                            if (
                                player.hasSkillTag("freeShan", false, null, true) ||
                                player.getEquip("rewrite_renwang")
                            )
                                num *= 0.8;
                            return num;
                        },
                        value: [7,5.1,2],
                    },
                    result: {
                        player: 1,
                    },
                },
                "_priority": 0,
            },
            "shikieiki_trial": {
                audio: "ext:车万符斗祭:2",
                trigger: {
                    global: "judge",
                },
                direct: true,
                filter: function(event,player){
                    return player.countCards('hes')>0;
                },
                content: function(){
                    "step 0"
                    player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ get.translation(trigger.player.judging[0])+'，'+get.prompt('shikieiki_trial'),'hes',function(card){
                        var player=_status.event.player;
                        var mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player);
                        if(mod2!='unchanged') return mod2;
                        var mod=game.checkMod(card,player,'unchanged','cardRespondable',player);
                        if(mod!='unchanged') return mod;
                        return true;
                    }).set('ai',function(card){
                        var trigger=_status.event.getTrigger();
                        var player=_status.event.player;
                        var judging=_status.event.judging;
                        var result=trigger.judge(card)-trigger.judge(judging);
                        var attitude=get.attitude(player,trigger.player);
                        if(attitude==0||result==0) return 0;
                        if(attitude>0){
                            return result-get.value(card)/2;
                        }
                        else{
                            return -result-get.value(card)/2;
                        }
                    }).set('judging',trigger.player.judging[0]);
                    "step 1"
                    if(result.bool){
                        player.respond(result.cards,'shikieiki_trial','highlight','noOrdering');
                    }
                    else{
                        event.finish();
                    }
                    "step 2"
                    if(result.bool){
                        if(trigger.player.judging[0].clone){
                            trigger.player.judging[0].clone.classList.remove('thrownhighlight');
                            game.broadcast(function(card){
                                if(card.clone){
                                    card.clone.classList.remove('thrownhighlight');
                                }
                            },trigger.player.judging[0]);
                            game.addVideo('deletenode',player,get.cardsInfo([trigger.player.judging[0].clone]));
                        }
                        game.cardsDiscard(trigger.player.judging[0]);
                        trigger.player.judging[0]=result.cards[0];
                        trigger.orderingCards.addArray(result.cards);
                        game.log(trigger.player,'的判定牌改为',result.cards[0]);
                        game.delay(2);
                    }
                },
                ai: {
                    rejudge: true,
                    tag: {
                        rejudge: 1,
                    },
                },
                "_priority": 0,
            },
            "shikieiki_majesty": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageEnd",
                },
                logTarget: "source",
                preHidden: true,
                filter: function(event, player) {
                    return event.source && event.source.countGainableCards(player, event.source != player ? "he" : "e") > 0 && event.num > 0;
                },
                content: async function(event, trigger, player) {
                    player.gainPlayerCard(true, trigger.source, trigger.source != player ? "he" : "e");
                },
                ai: {
                    "maixie_defend": true,
                    effect: {
                        target: function(card, player, target) {
                            if (player.countCards("he") > 1 && get.tag(card, "damage")) {
                                if (player.hasSkillTag("jueqing", false, target)) return [1, -1.5];
                                if (get.attitude(target, player) < 0) return [1, 1];
                            }
                        },
                    },
                },
                "_priority": 0,
            },
            "medicine_ciguatera": {
                audio: "ext:车万符斗祭:1",
                direct: true,
                trigger: {
                    global: "phaseZhunbeiBegin",
                },
                content: function(){
                    'step 0'
                    event.target=trigger.player;
                    player.chooseToDiscard(get.prompt('medicine_ciguatera',event.target),'he',{ color: 'black' }).set('ciguatera',get.attitude(player,trigger.player)<-2).set('ai',function(card){
                        if(!_status.event.ciguatera) return 0;
                        return 7-get.value(card);
                    }).logSkill=['medicine_ciguatera',event.target]; 
                    'step 1'
                    if (result.bool) { 
                        target.loseHp(); 
                    } 
                    else { 
                        event.finish(); 
                    }
                    'step 2'
                    target.addSkill("hezui");
                    game.log(player,"对",target,"使用了神经之毒。");
                    //var next=trigger.player.useCard({ name: 'jiu',isCard: false},target, true);
                    //next.animate=false;
                    //next.audio=false;
                    //trigger.player.chooseUseTarget({ name: 'jiu'}, true, 'nopopup', 'noanimate').set('logSkill','nolog');
                },
                "_priority": 0,
            },
            "medicine_melancholy": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageAfter",
                },
                check: function(event,player){ 
                    return get.attitude(player,event.source) <= 0; 
                },
                filter: function(event,player){ 
                    return event.source&&event.source!=player; 
                },
                content: function (){
                    "step 0" 
                    event.cards = get.cards(); 
                    player.showCards(event.cards); 
                    "step 1" 
                    player.gain(cards, 'gain2'); 
                    "step 2" 
                    if(get.suit(event.cards) !='club') {
                        trigger.source.addTempSkill('medicine_melancholy_block', 'phaseEnd');
                        game.log(player,"对",trigger.source,"使用了忧郁之毒，",trigger.source,"陷入了忧郁。");
                    }
                    else game.log(player,"对",trigger.source,"使用了忧郁之毒，",trigger.source,"陷入了忧郁。但",trigger.source,"缓了过来。");
                },
                ai: {
                    maixie: true,
                    "maixie_defend": true,
                    effect: {
                        target: function(card, player, target) {
                            if (player.countCards("h") > 1 ) {
                                if (player.hasSkillTag("jueqing", false, target)) return [1, -1.5];
                                if (get.attitude(target, player) < 0) return [1, 1];
                            }
                        },
                    },
                },
                subSkill: {
                    block: {
                        charlotte: true,
                        mark: true,
                        intro: {
                            content: "【忧郁】你不能使用或打出手牌",
                        },
                        mod: {
                            "cardEnabled2": function(card){
                                if(get.position(card)=='h') return false;
                            },
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "medicine_melancholy",
                    },
                },
                "_priority": 0,
            },
            "yuuka_rs": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    target: "useCardToTargeted",
                },
                filter: function (event, player) {
                    if(event.card.name == 'nanman' || event.card.name == 'wanjian' || event.card.name == 'wugu' || event.card.name == 'taoyuan') return false;
                    return event.player != player && event.card &&get.type(event.card) == 'trick'&& event.targets.length == 1;
                },
                check: function (event, player) {
                    return player.hp<=player.countCards("hs");
                    return lib.skill.card_umbrella_skill.filter(event, player);
                },
                content: function () {
                    'step 0'
                    trigger.card.name = 'juedou';
                    if (trigger.card.isCard && trigger.cards.length) {
                        trigger.card.isCard = false;
                    }
                },
                group: "yuuka_rs_sha",
                subSkill: {
                    sha: {
                        audio: "ext:车万符斗祭:1",
                        enable: ["chooseToUse","chooseToRespond"],
                        filter: function(event,player){ 
                            return player!=_status.currentPhase&&player.countCards('h')>0; 
                        },
                        viewAs: {
                            name: "sha",
                        },
                        viewAsFilter: function(player){
                            return player.countCards('hs')>0;
                        },
                        filterCard: true,
                        position: "hs",
                        prompt: "将一张手牌当做【杀】使用",
                        check: function(card){
                            return 6-get.value(card);
                        },
                        sub: true,
                        sourceSkill: "yuuka_rs",
                        ai: {
                            yingbian: function (card, player, targets, viewer) {
                                if (get.attitude(viewer, player) <= 0) return 0;
                                var base = 0,
                                    hit = false;
                                if (get.cardtag(card, "yingbian_hit")) {
                                    hit = true;
                                    if (
                                        targets.some((target) => {
                                            return (target.mayHaveShan(
                                                viewer,
                                                "use",
                                                target.getCards("h", (i) => {
                                                    return i.hasGaintag("sha_notshan");
                                                })
                                            ) && get.attitude(viewer, target) < 0 && get.damageEffect(target, player, viewer, get.natureList(card)) > 0);
                                        }))
                                        base += 5;
                                }
                                if (get.cardtag(card, "yingbian_add")) {
                                    if (game.hasPlayer(function (current) {
                                        return (!targets.includes(current) && lib.filter.targetEnabled2(card, player, current) && get.effect(current, card, player, player) > 0);
                                    }))
                                        base += 5;
                                }
                                if (get.cardtag(card, "yingbian_damage")) {
                                    if (targets.some((target) => {
                                        return (get.attitude(player, target) < 0 && (hit || !target.mayHaveShan(viewer,"use",target.getCards("h", (i) => {
                                            return i.hasGaintag("sha_notshan");
                                        })) || player.hasSkillTag("directHit_ai",true,{target: target,card: card,},true)) && !target.hasSkillTag("filterDamage", null, {player: player,card: card,jiu: true,
                                        }));
                                    }))
                                        base += 5;
                                }
                                return base;
                            },
                            canLink: function (player, target, card) {
                                if (!target.isLinked() && !player.hasSkill("wutiesuolian_skill")) return false;
                                if (player.hasSkill("jueqing") || player.hasSkill("gangzhi") || target.hasSkill("gangzhi")) return false;
                                return true;
                            },
                            basic: {
                                useful: [5,3,1],
                                value: [5,3,1],
                            },
                            order: function(item, player) {
                                let res = 3.2;
                                if (player.hasSkillTag("presha", true, null, true)) res = 10;
                                if (
                                    typeof item !== "object" ||
                                    !game.hasNature(item, "linked") ||
                                    game.countPlayer((cur) => cur.isLinked()) < 2
                                )
                                    return res;
                                //let used = player.getCardUsable('sha') - 1.5, natures = ['thunder', 'fire', 'ice', 'kami'];
                                let uv = player.getUseValue(item, true);
                                if (uv <= 0) return res;
                                let temp = player.getUseValue("sha", true) - uv;
                                if (temp < 0) return res + 0.15;
                                if (temp > 0) return res - 0.15;
                                return res;
                            },
                            result: {
                                target: function (player, target, card, isLink) {
                                    let eff = -1.5,
                                        odds = 1.35,
                                        num = 1;
                                    if (isLink) {
                                        let cache = _status.event.getTempCache("sha_result", "eff");
                                        if (typeof cache !== "object" || cache.card !== get.translation(card))
                                            return eff;
                                        if (cache.odds < 1.35 && cache.bool) return 1.35 * cache.eff;
                                        return cache.odds * cache.eff;
                                    }
                                    if (
                                        player.hasSkill("jiu") ||
                                        player.hasSkillTag("damageBonus", true, {
                                            target: target,
                                            card: card,
                                        })
                                    ) {
                                        if (
                                            target.hasSkillTag("filterDamage", null, {
                                                player: player,
                                                card: card,
                                                jiu: true,
                                            })
                                        )
                                            eff = -0.5;
                                        else {
                                            num = 2;
                                            if (get.attitude(player, target) > 0) eff = -7;
                                            else eff = -4;
                                        }
                                    }
                                    if (
                                        !player.hasSkillTag(
                                            "directHit_ai",
                                            true,
                                            {
                                                target: target,
                                                card: card,
                                            },
                                            true
                                        )
                                    )
                                        odds -=
                                            0.7 *
                                            target.mayHaveShan(
                                                player,
                                                "use",
                                                target.getCards("h", (i) => {
                                                    return i.hasGaintag("sha_notshan");
                                                }),
                                                "odds"
                                            );
                                    _status.event.putTempCache("sha_result", "eff", {
                                        bool: target.hp > num && get.attitude(player, target) > 0,
                                        card: get.translation(card),
                                        eff: eff,
                                        odds: odds,
                                    });
                                    return odds * eff;
                                },
                            },
                            tag: {
                                respond: 1,
                                respondShan: 1,
                                damage: function (card) {
                                    if (game.hasNature(card, "poison")) return;
                                    return 1;
                                },
                                natureDamage: function (card) {
                                    if (game.hasNature(card, "linked")) return 1;
                                },
                                fireDamage: function (card, nature) {
                                    if (game.hasNature(card, "fire")) return 1;
                                },
                                thunderDamage: function (card, nature) {
                                    if (game.hasNature(card, "thunder")) return 1;
                                },
                                poisonDamage: function (card, nature) {
                                    if (game.hasNature(card, "poison")) return 1;
                                },
                                "jy_xieDamage": function(card,naturex){
                                    if(game.hasNature(card,'jy_xie')) return 1;
                                },
                                "jy_duDamage": function(card,naturex){
                                    if(game.hasNature(card,'jy_du')) return 1;
                                },
                            },
                        },
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "yuuka_sadist": {
                audio: "ext:车万符斗祭:1",
                direct: true,
                trigger: {
                    source: "dieAfter",
                },
                filterTarget: function (card, player, target) { 
                    return game.hasPlayer(p => p != player && target.inRangeOf(player) && p.countCards('he'));
                },
                content: function () { 
                    'step 0'
                    player.chooseTarget(get.prompt('yuuka_sadist'),function(card,player,target){
                        return game.hasPlayer(p => p != player && target.inRangeOf(player) && p.countCards('he'))&& target.isAlive();
                    }).set('ai',function(target){ 
                        var player=_status.event.player; 
                        return get.damageEffect(target,player,player); 
                    }); 
                    'step 1' 
                    if(result.bool){ 
                        player.logSkill('yuuka_sadist',result.targets); 
                        result.targets[0].damage(); 
                    } 
                },
                ai: {
                    expose: 0.2,
                    threaten: 1.5,
                    effect: {
                    },
                },
                group: "yuuka_sadist_add",
                subSkill: {
                    add: {
                        trigger: {
                            source: "damageBegin",
                        },
                        forced: true,
                        frequent: function(event,player){ 
                            return get.attitude(player,event.player)<0&&event.player.hp==1; 
                        },
                        filter: function(event,player){ 
                            return event.player!=player&&event.player.hp==1&&event.notLink(); 
                        },
                        content: function(){ 
                            trigger.num++; 
                        },
                        ai: {
                            threaten: 1.2,
                        },
                        sub: true,
                        "_priority": 0,
                        sourceSkill: "yuuka_sadist",
                    },
                },
                "_priority": 0,
            },
            "tewi_lucky": {
                trigger: {
                    player: "loseEnd",
                    global: ["equipAfter","addJudgeAfter","gainAfter","loseAsyncAfter","addToExpansionAfter"],
                },
                forced: true,
                audio: "ext:车万符斗祭:1",
                filter: function (event,player){
                    return player.countCards('h')<1;
                },
                content: function (){
                    player.draw(2);
                },
                ai: {
                    threaten: 0.8,
                    effect: {
                        target: function(card) {
                            if (card.name == "guohe" || card.name == "liuxinghuoyu") return 0.5;
                        },
                    },
                    noh: true,
                    skillTagFilter: function(player, tag) {
                        if (tag == "noh") {
                            if (player.countCards("h") != 1) return false;
                        }
                    },
                },
                "_priority": 0,
            },
            "kogasa_surprise": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                filter: function (event, player) {
                    return player.countCards('h') > 0;
                },
                filterTarget: function (card, player, target) {
                    return player != target;
                },
                filterCard: true,
                check: function (card) {
                    return 8 - get.value(card);
                },
                discard: false,
                content: function () {
                    'step 0'
                    game.log(player, '把一张牌贴在头上，唰地一下出现在',target,'的面前。');
                    ui.cardPile.insertBefore(cards[0], ui.cardPile.firstChild);
                    target.chooseControl('heart2', 'diamond2', 'club2', 'spade2').set('ai', function (event) {
                        switch (Math.floor(Math.random() * 6)) {
                            case 0:
                                return 'heart2';
                            case 1:
                            case 4:
                            case 5:
                                return 'diamond2';
                            case 2:
                                return 'club2';
                            case 3:
                                return 'spade2';
                        }
                    });
                    'step 1'
                    game.log(target, '选择了' + get.translation(result.control));
                    event.choice = result.control;
                    target.chat('我选'+get.translation(event.choice));
                    event.cards = get.cards();
                    target.gain(event.cards);
                    target.addShownCards(event.cards,"visible_cards");
                    'step 2'
                    if (get.suit(event.cards) + '2' != event.choice){
                        player.chat('猜错了');
                        target.damage();
                        game.log(target, '受到了',player,'的惊吓，',event.cards,'被贴到了',target,'的头上。');
                    }
                    else
                        player.chat('猜对了');
                        game.log(target,'并没有被吓到，一把扯下了贴在头上的',event.cards,'。');
                },
                ai: {
                    order: 1,
                    result: {
                        target: function (player, target) {
                            var eff = get.damageEffect(target, player);
                            if (eff >= 0) return 1 + eff;
                            var value = 0, i;
                            var cards = player.get('h');
                            for (i = 0; i < cards.length; i++) {
                                value += get.value(cards[i]);
                            }
                            value /= player.countCards('h');
                            if (target.hp == 1) return Math.min(0, value - 7);
                            return Math.min(0, value - 5);
                        },
                    },
                },
                "_priority": 0,
            },
            "kogasa_jolly": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseDrawAfter",
                },
                forced: true,
                popup: false,
                content: function(){
                    'step 0'
                    player.chooseTarget('请选择目标','令一名角色摸一张牌').set('ai',function(target){
                        return get.attitude(_status.event.player,target)*Math.sqrt(Math.max(1,4-target.countCards('h')));
                    });
                    'step 1'
                    if(result.bool){
                        var target=result.targets[0];
                        player.logSkill('kogasa_jolly');
                        target.draw();
                        game.log(player,'非常愉快，牌堆顶的一张牌消失了，出现在',target,'的手上。');
                    }
                },
                "_priority": 0,
            },
            "patchouli_library": {
                audio: "ext:车万符斗祭:2",
                trigger: {
                    player: "useCard",
                },
                forced: true,
                filter: function (event) {
                    return get.type(event.card) == 'trick';
                },
                content: function () { 
                    player.draw(); 
                },
                mod: {
                    targetInRange: function (card, player, target, now) {
                        var type = get.type(card);
                        if (type == 'trick' || type == 'delay') return true;
                    },
                },
                "_priority": 0,
            },
            "patchouli_knowledge": {
                audio: "ext:车万符斗祭:1",
                forced: true,
                trigger: {
                    target: "useCardToTarget",
                },
                filter: function (event, player) {
                    return get.type(event.card)=='trick'&&get.suit(event.card)=='spade';//||(get.name(event.card)=='shandian'&&get.suit(event.card)=='spade');
                },
                content: function(){
                    trigger.getParent().excluded.add(player);
                    trigger.cancel();
                    game.log(player,"一眼就看穿了这张符卡，直接挡下。");
                },
                ai: {
                    effect: {
                        target: function (card, player, target, current) {
                            if (get.type(card, "trick") == "trick" && get.suit(card) == "spade") return "zeroplayertarget";
                        },
                    },
                },
                group: ["patchouli_knowledge_judgeBefore","patchouli_knowledge_zhunbei"],
                subSkill: {
                    judgeBefore: {
                        forced: true,
                        direct: true,
                        trigger: {
                            player: "phaseJudgeBefore",
                        },
                        filter: function (card, player) {
                            return player.countCards('js', { suit: 'spade' }) > 0;
                        },
                        content: function () {
                            player.chooseToDiscard(true, 'js', function (card) {
                                return get.suit(card) == 'spade';
                            });
                            player.logSkill("patchouli_knowledge");
                            game.log(player,"一眼就看穿了这张符卡，直接挡下。");
                        },
                        sub: true,
                        sourceSkill: "patchouli_knowledge",
                        "_priority": 0,
                    },
                    zhunbei: {
                        audio: "patchouli_knowledge",
                        trigger: {
                            player: "phaseZhunbeiBegin",
                        },
                        frequent: true,
                        filter: function (event, player) {
                            return player.countCards('j',{ suit: 'spade' }, 'shandian') > 0;
                        },
                        content: function () {
            var cards=player.getCards('j',{ suit: 'spade' },'shandian');
                    if(cards.length){
                        var card=cards[0];
                        var next=player.getNext();
                        next.addJudge(card);
                        next.$gain2([card]);
                        game.delayx();
                        game.log(player,"一眼就看穿了这张符卡，直接挡下。");
                    }
                        },
                        sub: true,
                        sourceSkill: "patchouli_knowledge",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "boss_tongchou": {
                unique: true,
                group: ["boss_tongchou_1"],
                zhuSkill: true,
                filter: function(event, player) {
                    if (!player.hasZhuSkill("boss_tongchou") || !game.hasPlayer(current => current != player)) return false;
                    return !event.jijiang && (event.type != "phase" || !player.hasSkill("boss_tongchou_2"));
                },
                enable: ["chooseToUse","chooseToRespond"],
                viewAs: {
                    name: "sha",
                },
                filterCard: function() {
                    return false;
                },
                selectCard: -1,
                ai: {
                    order: function() {
                        return get.order({ name: "sha" }) + 0.3;
                    },
                    respondSha: true,
                    skillTagFilter: function(player) {
                        if (!player.hasZhuSkill("boss_tongchou") || !game.hasPlayer(current => current != player)) return false;
                    },
                    yingbian: function (card, player, targets, viewer) {
                        if (get.attitude(viewer, player) <= 0) return 0;
                        var base = 0,
                            hit = false;
                        if (get.cardtag(card, "yingbian_hit")) {
                            hit = true;
                            if (
                                targets.some((target) => {
                                    return (
                                        target.mayHaveShan(
                                            viewer,
                                            "use",
                                            target.getCards("h", (i) => {
                                                return i.hasGaintag("sha_notshan");
                                            })
                                        ) &&
                                        get.attitude(viewer, target) < 0 &&
                                        get.damageEffect(target, player, viewer, get.natureList(card)) > 0
                                    );
                                })
                            )
                                base += 5;
                        }
                        if (get.cardtag(card, "yingbian_add")) {
                            if (
                                game.hasPlayer(function (current) {
                                    return (
                                        !targets.includes(current) &&
                                        lib.filter.targetEnabled2(card, player, current) &&
                                        get.effect(current, card, player, player) > 0
                                    );
                                })
                            )
                                base += 5;
                        }
                        if (get.cardtag(card, "yingbian_damage")) {
                            if (
                                targets.some((target) => {
                                    return (
                                        get.attitude(player, target) < 0 &&
                                        (hit ||
                                            !target.mayHaveShan(
                                                viewer,
                                                "use",
                                                target.getCards("h", (i) => {
                                                    return i.hasGaintag("sha_notshan");
                                                })
                                            ) ||
                                            player.hasSkillTag(
                                                "directHit_ai",
                                                true,
                                                {
                                                    target: target,
                                                    card: card,
                                                },
                                                true
                                            )) &&
                                        !target.hasSkillTag("filterDamage", null, {
                                            player: player,
                                            card: card,
                                            jiu: true,
                                        })
                                    );
                                })
                            )
                                base += 5;
                        }
                        return base;
                    },
                    canLink: function (player, target, card) {
                        if (!target.isLinked() && !player.hasSkill("wutiesuolian_skill")) return false;
                        if (
                            player.hasSkill("jueqing") ||
                            player.hasSkill("gangzhi") ||
                            target.hasSkill("gangzhi")
                        )
                            return false;
                        return true;
                    },
                    basic: {
                        useful: [5,3,1],
                        value: [5,3,1],
                    },
                    result: {
                        target: function (player, target, card, isLink) {
                            let eff = -1.5,
                                odds = 1.35,
                                num = 1;
                            if (isLink) {
                                let cache = _status.event.getTempCache("sha_result", "eff");
                                if (typeof cache !== "object" || cache.card !== get.translation(card))
                                    return eff;
                                if (cache.odds < 1.35 && cache.bool) return 1.35 * cache.eff;
                                return cache.odds * cache.eff;
                            }
                            if (
                                player.hasSkill("jiu") ||
                                player.hasSkillTag("damageBonus", true, {
                                    target: target,
                                    card: card,
                                })
                            ) {
                                if (
                                    target.hasSkillTag("filterDamage", null, {
                                        player: player,
                                        card: card,
                                        jiu: true,
                                    })
                                )
                                    eff = -0.5;
                                else {
                                    num = 2;
                                    if (get.attitude(player, target) > 0) eff = -7;
                                    else eff = -4;
                                }
                            }
                            if (
                                !player.hasSkillTag(
                                    "directHit_ai",
                                    true,
                                    {
                                        target: target,
                                        card: card,
                                    },
                                    true
                                )
                            )
                                odds -=
                                    0.7 *
                                    target.mayHaveShan(
                                        player,
                                        "use",
                                        target.getCards("h", (i) => {
                                            return i.hasGaintag("sha_notshan");
                                        }),
                                        "odds"
                                    );
                            _status.event.putTempCache("sha_result", "eff", {
                                bool: target.hp > num && get.attitude(player, target) > 0,
                                card: get.translation(card),
                                eff: eff,
                                odds: odds,
                            });
                            return odds * eff;
                        },
                    },
                    tag: {
                        respond: 1,
                        respondShan: 1,
                        damage: function (card) {
                            if (game.hasNature(card, "poison")) return;
                            return 1;
                        },
                        natureDamage: function (card) {
                            if (game.hasNature(card, "linked")) return 1;
                        },
                        fireDamage: function (card, nature) {
                            if (game.hasNature(card, "fire")) return 1;
                        },
                        thunderDamage: function (card, nature) {
                            if (game.hasNature(card, "thunder")) return 1;
                        },
                        poisonDamage: function (card, nature) {
                            if (game.hasNature(card, "poison")) return 1;
                        },
                        "jy_xieDamage": function(card,naturex){
                            if(game.hasNature(card,'jy_xie')) return 1;
                        },
                        "jy_duDamage": function(card,naturex){
                            if(game.hasNature(card,'jy_du')) return 1;
                        },
                    },
                },
                subSkill: {
                    "1": {
                        audio: "input",
                        trigger: {
                            player: ["useCardBegin","respondBegin"],
                        },
                        logTarget: "targets",
                        filter: function(event, player) {
                            return event.skill == "boss_tongchou";
                        },
                        forced: true,
                        content: async function(event, trigger, player) {
                            delete trigger.skill;
                            trigger.getParent().set("boss_tongchou", true);
                            while (true) {
                                if (event.current == undefined) event.current = player.next;
                                if (event.current == player) {
                                    player.addTempSkill("boss_tongchou_2");
                                    trigger.cancel();
                                    trigger.getParent().goto(0);
                                    return;
                                } 
                                const chooseToRespondEvent = event.current.chooseToRespond("是否替" + get.translation(player) + "打出一张弹幕？", { name: "sha" });
                                chooseToRespondEvent.set("ai", () => {
                                    const event = _status.event;
                                    return get.attitude(event.player, event.source) - 2;
                                });
                                chooseToRespondEvent.set("source", player);
                                chooseToRespondEvent.set("boss_tongchou", true);
                                chooseToRespondEvent.set("skillwarn", "替" + get.translation(player) + "打出一张弹幕");
                                chooseToRespondEvent.noOrdering = true;
                                chooseToRespondEvent.autochoose = lib.filter.autoRespondSha;
                                const { bool, card, cards } = (await chooseToRespondEvent).result;
                                if (bool) {
                                    trigger.card = card;
                                    trigger.cards = cards;
                                    trigger.throw = false;
                                    if (typeof event.current.ai.shown == "number" && event.current.ai.shown < 0.95) {
                                        event.current.ai.shown += 0.3;
                                        if (event.current.ai.shown > 0.95) event.current.ai.shown = 0.95;return;
                                    } else event.current = event.current.next;
                                } else event.current = event.current.next;
                            }
                        },
                        sub: true,
                        sourceSkill: "boss_tongchou",
                        "_priority": 0,
                    },
                    "2": {
                        trigger: {
                            global: ["useCardAfter","useSkillAfter","phaseAfter"],
                        },
                        silent: true,
                        charlotte: true,
                        filter: function(event) {
                            return event.skill != "boss_tongchou";
                        },
                        content: async function(event, trigger, player) {
                            player.removeSkill("boss_tongchou_2");
                        },
                        forced: true,
                        popup: false,
                        sub: true,
                        sourceSkill: "boss_tongchou",
                        "_priority": 1,
                    },
                },
                "_priority": 0,
            },
            "boss_xieli": {
                audio: "input",
                unique: true,
                zhuSkill: true,
                trigger: {
                    player: ["chooseToRespondBefore","chooseToUseBefore"],
                },
                filter: function(event, player) {
                    if (event.responded) return false;
                    if (player.storage.boss_xieliing) return false;
                    if (!player.hasZhuSkill("boss_xieli")) return false;
                    if (!event.filterCard({ name: "shan", isCard: true }, player, event)) return false;
                    return game.hasPlayer(current => current != player);
                },
                check: function(event, player) {
                    if (get.damageEffect(player, event.player, player) >= 0) return false;
                    return true;
                },
                content: async function(event, trigger, player) {
                    while (true) {
                        let bool;
                        if (!event.current) event.current = player.next;
                        if (event.current == player) return;
                            if ((event.current == game.me && !_status.auto) || get.attitude(event.current, player) > 2 || event.current.isOnline()) {
                                player.storage.boss_xieliing = true;
                                const next = event.current.chooseToRespond("是否替" + get.translation(player) + "打出一张闪？", { name: "shan" });
                                next.set("ai", () => {
                                    const event = _status.event;
                                    return get.attitude(event.player, event.source) - 2;
                                });
                                next.set("skillwarn", "替" + get.translation(player) + "打出一张闪");
                                next.autochoose = lib.filter.autoRespondShan;
                                next.set("source", player);
                                bool = (await next).result.bool;
                            }
                        player.storage.boss_xieliing = false;
                        if (bool) {
                            trigger.result = { bool: true, card: { name: "shan", isCard: true } };
                            trigger.responded = true;
                            trigger.animate = false;
                            if (typeof event.current.ai.shown == "number" && event.current.ai.shown < 0.95) {
                                event.current.ai.shown += 0.3;
                                if (event.current.ai.shown > 0.95) event.current.ai.shown = 0.95;
                            }
                            return;
                        } else {
                            event.current = event.current.next;
                        }
                    }
                },
                ai: {
                    respondShan: true,
                    skillTagFilter: function(player) {
                        if (player.storage.boss_xieliing) return false;
                        if (!player.hasZhuSkill("boss_xieli")) return false;
                        return game.hasPlayer(current => current != player);
                    },
                },
                "_priority": 0,
            },
            "boss_xisheng": {
                audio: "input",
                unique: true,
                zhuSkill: true,
                trigger: {
                    player: "recoverAfter",
                },
                direct: true,
                filter: function (event,player){
                    if (player.isDying()||player.hp != 1) return false;
                    if (!event.card || event.card.name != "tao") return false;
                    return true;
                },
                check: function (event,player){
                    return get.attitude(player,event.source)>=0;
                },
                logTarget: "source",
                content: function (){
                    'step 0'
                    trigger.source.chooseBool(get.prompt2("boss_xisheng")).set('ai', function () {
                        var evt = _status.event;
                        return get.attitude(evt.player, evt.getParent().player) > 0 && evt.getParent().player.hp <= evt.player.hp && !evt.player.isDying();
                    });
                    'step 1'
                    if (result.bool) {
                        player.logSkill('boss_xisheng');
                        trigger.source.loseHp();
                        player.recover(trigger.source);
                    }
                },
                "_priority": 0,
            },
            "boss_yingyuan": {
                zhuSkill: true,
                mod: {
                    maxHandcard: function (player, num) {
                        return num + game.countPlayer(function (current) {
                            if (current.identity == 'zhong') return 1;
                        });
                    },
                },
                "_priority": 0,
            },
            "喝醉描述": {
                "_priority": 0,
            },
            "youmu_nitoryuu": {
                audio: "ext:车万符斗祭:1",
                Yx: true,
                popup: false,
                trigger: {
                    global: "phaseBefore",
                    player: "enterGame",
                },
                forced: true,
                filter: function(event, player) {
                    return (event.name != "phase" || game.phaseNumber == 0);
                },
                content: function() {
                    player.expandEquip(1);
                },
                group: ["youmu_nitoryuu_equiped","youmu_nitoryuu_phaseSha"],
                subSkill: {
                    equiped: {
                        audio: "youmu_nitoryuu",
                        trigger: {
                            player: "equipAfter",
                        },
                        frequent: true,
                        filter: function (event, player) {
                            return get.subtype(event.card)=='equip1' && player.getEquips(1).length == 2;
                        },
                        content: function () {
                            if(_status.currentPhase == player){
                                player.addTempSkill("youmu_nitoryuu_shaCount","phaseEnd");
                            }
                            if(player.getEquips(1).length < 2){
                                if(player.storage.ganjin > 0){
                                    player.storage.ganjin -= 1;
                                    game.log(player,"失去了一点干劲");
                                }
                                player.removeSkill("youmu_nitoryuu_shaCount");
                            }
                            
                        },
                        sub: true,
                        sourceSkill: "youmu_nitoryuu",
                        "_priority": 0,
                    },
                    phaseSha: {
                        trigger: {
                            player: "phaseUseBegin",
                        },
                        direct: true,
                        filter: function (event, player) {
                            return player.getEquips(1).length == 2;
                        },
                        content: function (){
                            game.log(player,"额外获得了一点干劲");
                            player.storage.ganjin += 1;
                        },
                        sub: true,
                        sourceSkill: "youmu_nitoryuu",
                        "_priority": 0,
                    },
                    shaCount: {
                        trigger: {
                            player: "equipAfter",
                        },
                        frequent: true,
                        filter: function (event, player) {
                            return true;
                        },
                        usable: 1,
                        content: function(){
                            game.log(player,"额外获得了一点干劲");
                            player.storage.ganjin += 1;
                        },
                        charlotte: true,
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/attacked.png >",
                        intro: {
                            content: "出牌阶段你可以额外使用一张弹幕。",
                        },
                        sub: true,
                        sourceSkill: "youmu_nitoryuu",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "youmu_mjchz": {
                audio: "ext:车万符斗祭:1",
                forced: true,
                locked: true,
                group: ["youmu_mjchz_sha","youmu_mjchz_juedou"],
                preHidden: ["youmu_mjchz_sha","youmu_mjchz_juedou"],
                subSkill: {
                    sha: {
                        audio: "youmu_mjchz",
                        trigger: {
                            player: "useCardToPlayered",
                        },
                        forced: true,
                        filter: function(event, player) {
                            return event.card.name == "sha" && !event.getParent().directHit.includes(event.target);
                        },
                        logTarget: "target",
                        content: async function(event, trigger, player) {
                            const id = trigger.target.playerid;
                            const map = trigger.getParent().customArgs;
                            if (!map[id]) map[id] = {};
                            if (typeof map[id].shanRequired == "number") {
                                map[id].shanRequired++;
                            } else {
                                map[id].shanRequired = 2;
                            }
                        },
                        ai: {
                            "directHit_ai": true,
                            skillTagFilter: function(player, tag, arg) {
                                if (arg.card.name != "sha" || arg.target.countCards("h", "shan") > 1) return false;
                            },
                        },
                        sub: true,
                        sourceSkill: "youmu_mjchz",
                        "_priority": 0,
                    },
                    juedou: {
                        audio: "youmu_mjchz",
                        trigger: {
                            player: "useCardToPlayered",
                            target: "useCardToTargeted",
                        },
                        forced: true,
                        logTarget: function(trigger, player) {
                            return player == trigger.player ? trigger.target : trigger.player;
                        },
                        filter: function(event, player) {
                            return event.card.name == "juedou";
                        },
                        content: async function(event, trigger, player) {
                            const id = (player == trigger.player ? trigger.target : trigger.player)["playerid"];
                            const idt = trigger.target.playerid;
                            const map = trigger.getParent().customArgs;
                            if (!map[idt]) map[idt] = {};
                            if (!map[idt].shaReq) map[idt].shaReq = {};
                            if (!map[idt].shaReq[id]) map[idt].shaReq[id] = 1;
                            map[idt].shaReq[id]++;
                        },
                        ai: {
                            "directHit_ai": true,
                            skillTagFilter: function(player, tag, arg) {
                                if (arg.card.name != "juedou" || Math.floor(arg.target.countCards("h", "sha") / 2) > player.countCards("h", "sha")) return false;
                            },
                        },
                        sub: true,
                        sourceSkill: "youmu_mjchz",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "yugi_fp": {
                audio: "ext:车万符斗祭:1",
                shaRelated: true,
                trigger: {
                    player: "useCardToPlayered",
                },
                check: function (event, player) {
                    return get.attitude(player, event.target) < 0;
                },
                filter: function (event, player) {
                    return event.card.name == 'sha';
                },
                logTarget: "target",
                preHidden: true,
                content: function () {
                    'step 0'
                    player.judge(function (card) {
                        if (get.color(card) == 'red') return 2;
                        return -1;
                    }).judge2 = function (result) {
                        return result.bool;
                    };
                    'step 1'
                    if (result.bool) trigger.getParent().directHit.add(trigger.target);
                    else player.addTempSkill("yugi_fp_discard");
                },
                subSkill: {
                    discard: {
                        trigger: {
                            source: "damageEnd",
                        },
                        frequent: true,
                        popup: false,
                        filter: function (event, player) {
                            return event.card && event.card.name == 'sha' && event.notLink() && event.player != player;
                        },
                        content: function () {
                            player.discardPlayerCard(trigger.player, 'he', true);
                        },
                        sub: true,
                        sourceSkill: "yugi_fp",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "yugi_qiangxi": {
                forced: true,
                mod: {
                    globalFrom: function(from, to, distance) {
                        return distance - 1;
                    },
                },
                "_priority": 0,
            },
            "mokou_reborn": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseZhunbeiBegin",
                },
                direct: true,
                filter: function (event, player) {
                    return player.hp < player.maxHp &&player.getCards("he").length > player.hp;
                },
                content: function () {
                    "step 0"
                    player.chooseToDiscard(get.prompt2("mokou_reborn"),player.hp,'he',{ color:"red" }).set('ai', function (card) {
                                return 6 - get.value(card);
                            });
                    "step 1"
                    if(result.bool) {
                        player.logSkill("mokou_reborn");
                        player.recover();}
                },
                ai: {
                    skillTagFilter: function(player) {
                        if (!player.countCards("he", { color: "red" })) return true;
                    },
                },
                "_priority": 0,
            },
            "mokou_ashes": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseJieshuBegin",
                },
                check: function (event, player) {
                    return player.hp >= 3 ||player.countCards('hs', { name: 'tao' }) + player.hp > 1;
                },
                content: function() {
                    player.loseHp(1);
                    player.draw(2);
                },
                "_priority": 0,
            },
            input: {
                audio: "ext:车万符斗祭:1",
                "_priority": 0,
            },
            upgrade: {
                audio: "input",
                juexingji: true,
                forced: true,
                trigger: {
                    global: "gameDrawAfter",
                },
                filter: function(event,player){
                    return game.countPlayer(function(current){return current.group=='fdj'})<=game.players.length/2 || game.hasPlayer(function (current) {
                        return current.group == "shen";
                    });
                },
                content: function () {
                    //若游戏开始时符势力人数不足一半，你将开桂；若存在神势力，你将变得不讲武德，获得御结。
                    "step 0"
                    player.awakenSkill('upgrade');
                    "step 1"
                    if(game.hasPlayer(function (current){return current.group == "shen"})){
                        //player.clearSkills();
                        player.addTempSkill("yujie","phaseBegin");
                    }
                    //player.addSkill("drawup");
                    player.removeSkill('upgrade');
                },
                "_priority": 0,
            },
            numup: {
                trigger: {
                    player: "drawBegin",
                },
                direct: true,
                content: function () {
                    trigger.num += Math.floor((player.maxHp+player.getDamagedHp())/3);
                },
                "_priority": 0,
            },
            yujie: {
                audio: "shiki_omusubi",
                trigger: {
                    global: "roundStart",
                },
                usable: 1,
                direct: true,
                content: function() {
                    "step 0";
                    player.chooseTarget(get.prompt2("shiki_omusubi"), lib.filter.notMe).set("ai", function (target) {
                        var player = _status.event.player;
                        if (player.isHealthy()) return 0;
                        if (player.hp < 3 && player.getDamagedHp() < 2) return 0;
                        var list = [];
                        if (lib.character[target.name]) list.addArray(lib.character[target.name][3]);
                        if (lib.character[target.name1]) list.addArray(lib.character[target.name1][3]);
                        if (lib.character[target.name2]) list.addArray(lib.character[target.name2][3]);
                        list = list.filter(function (i) {
                            return !player.hasSkill(i);
                        });
                        if (!list.length) return 0;
                        return 1 + Math.random();
                    });
                    "step 1";
                    if (result.bool) {
                        var target = result.targets[0];
                        player.logSkill("shiki_omusubi", target);
                        var list = [];
                        if (lib.character[target.name]) list.addArray(lib.character[target.name][3]);
                        if (lib.character[target.name1]) list.addArray(lib.character[target.name1][3]);
                        if (lib.character[target.name2]) list.addArray(lib.character[target.name2][3]);
                        player.addSkills(list);
                        game.broadcastAll(function (list) {
                            //lib.character.key_shiki[3].addArray(list);
                            game.expandSkills(list);
                            for (var i of list) {
                                var info = lib.skill[i];
                                if (!info) continue;
                            }
                        }, list);
                    }
                },
                "_priority": 0,
            },
            "test2": {
                mod: {
                    selectTarget: function (card, player, range) {
                        if (range[1] == -1) return;
                        //if(player.getEquip(1)) return;
                        if (card.name == 'sha') range[1] += 1;
                        if (get.type(card) == 'trick') range[1] += 1;
                    },
                },
                "_priority": 0,
            },
            "reimu_exterminate_damage": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageEnd",
                },
                direct: true,
                priority: 15,
                filter: function (event,player){ 
                    if(event.source==player&&_status.currentPhase==player) return false; 
                     
                    return player.canUse({name:'sha'},event.source,false)&&(event.source.isIn()&&player!=_status.currentPhase); 
                },
                content: function (){
                    player.chooseToUse(function(card,player,event){ 
                        if(get.name(card)!='sha') return false; 
                        return lib.filter.filterCard.apply(this,arguments); 
                    },'是否对'+get.translation(_status.currentPhase)+'使用一张弹幕？').set('complexSelect',true).set('logSkill','reimu_exterminate_damage').set('filterTarget',function(card,player,target){ 
                        if(target!=_status.event.sourcex&&!ui.selected.targets.contains(_status.event.sourcex)) return false; 
                        return lib.filter.targetEnabled.apply(this,arguments); 
                    }).set('sourcex',_status.currentPhase); 
                },
                ai: {
                    maixie: true,
                    "maixie_defend": true,
                    effect: {
                        target: function(card, player, target) {
                        if (player.countCards("h") > 1 ) {
                                if (player.hasSkillTag("jueqing", false, target)) return [1, -1.5];
                                if (get.attitude(target, player) < 0) return [1, 1];
                        }
                        },
                    },
                },
                "_priority": 1500,
            },
            mikittawa: {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageEnd",
                },
                direct: true,
                priority: 15,
                filter: function (event,player){ 
                    if(event.source==player&&_status.currentPhase==player) return false; 
                     
                    return player.canUse({name:'sha'},event.source,false)&&(event.source.isIn()&&player!=_status.currentPhase); 
                },
                content: function (){
                    player.chooseToUse(function(card,player,event){ 
                        if(get.name(card)!='sha') return false; 
                        return lib.filter.filterCard.apply(this,arguments); 
                    },'是否对'+get.translation(trigger.source)+'使用一张杀？').set('complexSelect',true).set('logSkill','mikittawa').set('filterTarget',function(card,player,target){ 
                        if(target!=_status.event.sourcex&&!ui.selected.targets.contains(_status.event.sourcex)) return false; 
                        return lib.filter.targetEnabled.apply(this,arguments); 
                    }).set('sourcex',trigger.source);
                    player.addTempSkill("mikittawa_direct");
                },
                ai: {
                    maixie: true,
                    "maixie_defend": true,
                    effect: {
                        target: function(card, player, target) {
                        if (player.countCards("h") > 1 ) {
                                if (player.hasSkillTag("jueqing", false, target)) return [1, -1.5];
                                if (get.attitude(target, player) < 0) return [1, 1];
                        }
                        },
                    },
                },
                subSkill: {
                    direct: {
                        trigger: {
                            player: "shaBegin",
                        },
                        direct: true,
                        content: function(){
                            trigger.directHit = true;
                        },
                        sub: true,
                        sourceSkill: "mikittawa",
                        "_priority": 0,
                    },
                },
                "_priority": 1500,
            },
            sinsackhat: {
                equipSkill: true,
                trigger: {
                    player: "phaseJudgeAfter",
                },
                direct: true,
                content: function(){
                    "step 0"
                    player.judge(function (card) {
                      if (get.suit(card)=='spade'&&get.number(card)<9) return 2;
                      return -2;
                    }).judge2 = result => result.bool;
                    "step 1"
                    if(result.bool){
                        game.playAudio("../extension/车万符斗祭/",'card_sinsackhat');
                        player.damage(2,'nosource');
                        game.log(player,"被推倒了。。。");
                        var es = player.getCards("e",{subtype: 'equip2'});
                        player.gain(es);
                        player.$gain2(es);
                    }
                },
                "_priority": -25,
            },
            suwakohat: {
                equipSkill: true,
                trigger: {
                    player: "phaseDiscardBegin",
                },
                direct: true,
                content: function () {
                    game.playAudio("../extension/车万符斗祭/",'card_suwakohat');
                  },
                mod: {
                    maxHandcard: function (player, current) {
                      return current + 2;
                    },
                },
                "_priority": -25,
            },
            hezui: {
                trigger: {
                    player: "damageBegin1",
                },
                Yx: true,
                popup: false,
                filter: function (event, player) {
                    return event.num >= player.hp;
                },
                charlotte: true,
                mark: true,
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/wine.gif >",
                intro: {
                    content: "你喝醉了",
                },
                forced: true,
                content: function () {
                    "step 0"
                    player.changeHujia();
                    //trigger.num -= 1;
                    game.log(player,"醒酒了。");
                    player.removeSkill("hezui");
                    //game.broadcastAll(function (player) {
                        //player.removeSkill("jiu");
                    //}, player);
                    //game.addVideo("jiuNode", player, false);
                },
                group: ["hezui_phaselose","hezui_sha"],
                subSkill: {
                    phaselose: {
                        trigger: {
                            player: "phaseBefore",
                        },
                        Yx: true,
                        forced: true,
                        popup: false,
                        content: function(){
                            game.log(player,"醒酒了。");
                            player.removeSkill("hezui");
                            //game.broadcastAll(function (player) {
                                //player.removeSkill("jiu");
                            //}, player);
                            //game.addVideo("jiuNode", player, false);
                        },
                        sub: true,
                        sourceSkill: "hezui",
                        "_priority": 5,
                    },
                    sha: {
                        trigger: {
                            player: "useCard",
                        },
                        filter: function (event, target) {
                            return event.card.name == 'sha';
                        },
                        content: function(){
                            "step 0"
                            //player.when('useCard')
                //.filter((event,player)=>event.card.name=='sha')
                //.then(()=>{
                //trigger.baseDamage++;
                //});
                            //trigger.num++;
                            trigger.baseDamage++;
                            "step 1"
                            game.log(player,"醒酒了。");
                            player.removeSkill("hezui");
                        },
                        Yx: true,
                        forced: true,
                        popup: false,
                        sub: true,
                        sourceSkill: "hezui",
                        "_priority": 1,
                    },
                    chixu: {
                        trigger: {
                            global: "phaseBegin",
                        },
                        filter: function(event,player){
                            return player != _status.currentPhase;
                        },
                        Yx: true,
                        direct: true,
                        content: function(){
                            //player.chooseUseTarget({ name: 'jiu', isCard: false}, true, false, 'nopopup','noanimate').set('logSkill','nolog');
                        },
                        sub: true,
                        sourceSkill: "hezui",
                        "_priority": 0,
                        ai: {
                            basic: {
                                useful: (card, i) => {
                                    if (_status.event.player.hp > 1) {
                                        if (i === 0) return 4;
                                        return 1;
                                    }
                                    if (i === 0) return 7.3;
                                    return 3;
                                },
                                value: (card, player, i) => {
                                    if (player.hp > 1) {
                                        if (i === 0) return 5;
                                        return 1;
                                    }
                                    if (i === 0) return 7.3;
                                    return 3;
                                },
                            },
                            order: () => {
                                if (_status.event.dying) return 9;
                                let sha = get.order({ name: "sha" });
                                if (sha > 0) return sha + 0.2;
                                return 0;
                            },
                            result: {
                                target: (player, target, card) => {
                                    if (target && target.isDying()) return 2;
                                    if (!target || target._jiu_temp || !target.isPhaseUsing()) return 0;
                                    let usable = target.getCardUsable("sha");
                                    if (
                                        !usable ||
                                        (lib.config.mode === "stone" &&
                                         !player.isMin() &&
                                            player.getActCount() + 1 >= player.actcount) ||
                                        !target.mayHaveSha(player, "use", card)
                                    )
                                        return 0;
                                    let effs = { order: 0 },
                                        temp;
                                    target.getCards("hs", (i) => {
                                        if (get.name(i) !== "sha" || ui.selected.cards.includes(i)) return false;
                                        temp = get.order(i, target);
                                        if (temp < effs.order) return false;
                                        if (temp > effs.order) effs = { order: temp };
                                        effs[i.cardid] = {
                                            card: i,
                                            target: null,
                                            eff: 0,
                                        };
                                    });
                                    delete effs.order;
                                    for (let i in effs) {
                                        if (!lib.filter.filterCard(effs[i].card, target)) continue;
                                        game.filterPlayer((current) => {
                                            if (
                                                get.attitude(target, current) >= 0 ||
                                                !target.canUse(effs[i].card, current, null, true) ||
                                                current.hasSkillTag("filterDamage", null, {
                                                    player: target,
                                                    card: effs[i].card,
                                                    jiu: true,
                                                })
                                            )
                                                return false;
                                            temp = get.effect(current, effs[i].card, target, player);
                                            if (temp <= effs[i].eff) return false;
                                            effs[i].target = current;
                                            effs[i].eff = temp;
                                            return false;
                                        });
                                        if (!effs[i].target) continue;
                                        if (
                                            target.hasSkillTag(
                                                "directHit_ai",
                                                true,
                                                {
                                                    target: effs[i].target,
                                                    card: i,
                                                },
                                                true
                                            ) ||
                                            (usable === 1 &&
                                                (target.needsToDiscard() > Math.max(0, 3 - target.hp) ||
                                                    !effs[i].target.mayHaveShan(
                                                        player,
                                                        "use",
                                                        effs[i].target.getCards((i) => {
                                                            return i.hasGaintag("sha_notshan");
                                                        })
                                                    )))
                                        ) {
                                            delete target._jiu_temp;
                                            return 1;
                                        }
                                    }
                                    delete target._jiu_temp;
                                    return 0;
                                },
                            },
                            tag: {
                                save: 1,
                                recover: 0.1,
                            },
                        },
                    },
                },
                "_priority": 0,
            },
            umbrella: {
                equipSkill: true,
                direct: true,
                trigger: {
                    player: "damageBegin4",
                },
                filter: function(event,player){
                     return get.type(event.card,'trick')=='trick';
                    //if(event.name=='damage'){
                     //   if(event.source&&event.source.hasSkillTag('unequip',false,{ name:event.card?event.card.name:null, target:player, card:event.card                                                               }))
                    //        return false;
                     //   return event.card&&get.type2(event.card)=='trick';
                    //}
                },
                content: function (){
                    game.playAudio("../extension/车万符斗祭/",'card_umbrella_on');
                    game.log(player,'受到的',get.translation(trigger.card),'效果被阳伞挡下了…');
                    trigger.cancel();
                },
                ai: {
                    notrick: true,
                    effect: {
                        target: function(card,player,target,current){
                            if (get.type(card)=='trick'&&get.tag(card,'damage')) return 'zeroplayertarget';
                        },
                    },
                },
                "_priority": -25,
            },
            "无懈#黑桃": {
                audio: "patchouli_knowledge",
                forced: true,
                frequent: true,
                trigger: {
                    player: "wuxieBegin",
                },
                filter: function (event,player){
                    return event.card&&get.type(event.card)=='trick'&&get.suit(event.card)=='spade' &&event.player != player;
                },
                check: function (event,player){
                    if(get.attitude(player,event.target)<=0){
                        return true;
                    }
                    return false;
                },
                content: function (){
                    trigger.untrigger();
                    trigger.finish();
                    game.log(player,"一眼就看穿了这张符卡，直接挡下。");
                },
                "_priority": 0,
            },
            "闪电#黑桃": {
                audio: "patchouli_knowledge",
                mod: {
                    targetEnabled: function (card) {
                        if (card.name == 'shandian'&&get.suit(card) == 'spade') return false;
                    },
                },
                forced: true,
                frequent: true,
                trigger: {
                    player: "phaseJudgeBefore",
                },
                filter: function (card, player) {
                            return player.countCards('js', { suit: 'spade' }) > 0;
                },
                content: function () {
                    player.chooseToDiscard(true, 'js', function (card) {
                        return get.suit(card) == 'spade';
                    });
                    game.log(player,"一眼就看穿了这张符卡，直接挡下。");
                },
                "_priority": 0,
            },
            "sanae_goddescendant": {
                audio: "ext:车万符斗祭:2",
                direct: true,
                filter: function (event, player) {
                    return get.type(event.card) == "trick" && (event.card.name == 'nanman' || event.card.name == 'wanjian' || event.card.name == 'wugu' || event.card.name == 'taoyuan');
                },
                check: function (event, player) {
                    if(event.card.name == 'wugu'||(event.card.name == 'taoyuan'&&player.hp==player.maxHp)) return false;
                    return event.getParent().excluded.includes(player) || get.tag(event.card, "multineg") || get.effect(player, event.card, event.player, player) <= 0;
                },
                trigger: {
                    target: "useCardToTargeted",
                },
                content: async function(event, trigger, player) {
                    const { result: { cards } } = await player.chooseCard('he', get.prompt2('sanae_goddescendant'));
                    if (cards) {
                        player.recast(cards);
                        player.logSkill("sanae_goddescendant");
                        trigger.targets.remove(player);
                        trigger.getParent().excluded.add(player);
                        trigger.cancel();
                    } 
                },
                ai: {
                    effect: {
                        target: function(card) {
                            if (get.type(card) != "trick") return;
                            if (card.name == "tiesuo") return [0, 0];
                            if (card.name == "yihuajiemu") return [0, 1];
                            if (get.tag(card, "multineg")) return [0, 2];
                        },
                    },
                },
                "_priority": 0,
            },
            "sanae_faith": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                filterTarget: function (card,player,target){
                    return player!=target&&target.countCards('h');
                },
                selectTarget: [1,2],
                multitarget: true,
                multiline: true,
                content: async function(event, trigger, player) {
                    const targets = event.targets.slice(0);
                    targets.forEach(async target => {
                        if (player.isIn() && target.countCards("h") > 0) {
                            //写给牌AI
                            await target.chooseToGive(player, "h", true).set("ai", function (card) {
                                game.delay(0.5);
                                var evt = _status.event.getParent();
                                if (get.attitude(evt.target, evt.player) > 0) {
                                        return get.value(card);
                                }
                                return -get.value(card);
                        });
                        } 
                    });
                    targets.forEach(async target=>{
                        await player.chooseToGive(target, "he", true).set("ai", function (card) {
                                game.delay(0.5);
                                var evt = _status.event.getParent();
                                if (get.attitude(evt.target, evt.player) > 0) {
                                        return get.value(card);
                                }
                                return -get.value(card);
                        });
                    });
                },
                ai: {
                    order: 7,
                    result: {
                        player: 1,
                        target: -0.5,
                    },
                    expose: 0.4,
                    threaten: 1.2,
                },
                "_priority": 0,
            },
            "sanae_miracle": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                position: "he",
                filterCard: true,
                selectCard: function () {
                    var player = _status.event.player;
                    var n = player.getHistory('useSkill', function (evt) {
                        return evt.skill == 'sanae_miracle';
                    }).length+1
                    return n;
                },
                prompt: function () {
                    var player = _status.event.player;
                    var n = player.getHistory('useSkill', function (evt) {
                        return evt.skill == 'sanae_miracle';
                    }).length+1
                    return '弃置' + get.cnNumber(n) + '张牌并摸' + get.cnNumber(1) + '张牌'+'（若弃置数为3，你可以令一名角色回复1点体力）'
                },
                check: function (card) {
                    var player = _status.event.player;
                    if (player.countCards('h') < player.hp && player.getHistory('useSkill', function (evt) {
                        return evt.skill == 'sanae_miracle';
                    }).length+1 < 3) return 0;
                    return 6 - get.value(card)
                },
                content: function () {
                    'step 0'
                    player.draw();
                    if (player.getHistory('useSkill', function (evt) {
                        return evt.skill == 'sanae_miracle';
                   }).length == 3) {
                        //发动次数为3
                        player
                        .chooseTarget(get.prompt2("sanae_miracle"), function (card, player, target) {
                            return target.hp < target.maxHp;
                        })
                        .set("autodelay", true).ai = function (target) {
                        var num = get.attitude(player, target);
                        if (num > 0) {
                            if (player == target) {
                                num = 0.5;
                            } else if (target.hp == 1) {
                                num += 3;
                            } else if (target.hp == 2) {
                                num += 1;
                            }
                        }
                        return num;
                        };
                        //柳梦璃
                    }
                    "step 1"
                    if (result.bool) {
                        result.targets[0].recover();
                    }
                },
                ai: {
                    order: 4,
                    result: {
                        player: 1,
                    },
                },
                "_priority": 0,
            },
            fenpai: {
                enable: "phaseUse",
                usable: 1,
                filterTarget: function (card,player,target){
                    return player!=target&&target.countCards('h');
                },
                selectTarget: [1,2],
                content: function () {
                    "step 0"
                    target.chooseCard('交给' + get.translation(player) + '一张牌', true);
                    "step 1"
                    if (result.bool) {
                        player.gain(result.cards, target);
                        target.$giveAuto(result.cards, player);
                    }
                    "step 2"
                    player.chooseCard('交给' + get.translation(target) + '一张牌', true);
                    "step 3"
                    if (result.bool) {
                        target.gain(result.cards, player);
                        player.$giveAuto(result.cards, target);
                    }
                },
                "_priority": 0,
            },
            drawup: {
                trigger: {
                    player: "phaseDrawBegin2",
                },
                filter: function(event, player) {
                return !event.numFixed;
                },
                content: function() {
                trigger.num += Math.floor((2*player.maxHp-player.hp));
                },
                direct: true,
                mod: {
                    maxHandcard: (player, num) => num += Math.floor(2*player.maxHp-player.hp),
                },
                "_priority": -2,
            },
            "spflan_four": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageBefore",
                },
                filter: function (event,player){
                   return event.num<=player.hp;
                },
                check: function (event,player){
                    if (event.num>player.getDamagedHp()) return false;
                    return player.maxHp != 1 &&event.num > player.countCards('h','tao')&&!player.countCards('h','shan')||player.getDamagedHp()>=1;
                    var evt = _status.event.getParent();
                    return player.maxHp == 1 && get.attitude(evt.trigger.player, evt.player) < 0;
                },
                content: function (){
                    trigger.cancel();
                    player.maxHp--;
                    player.update();
                    if(player.maxHp==0){player.die();}
                },
                ai: {
                    halfneg: true,
                },
                group: ["spflan_four_low"],
                subSkill: {
                    low: {
                        trigger: {
                            source: "damageBegin1",
                        },
                        direct: true,
                        filter: function(event,player) {
                            return player.hp == 1 && event.card && event.notLink();
                        },
                        content: async function(event, trigger, player) {
                            trigger.num++;
                        },
                        ai: {
                            damageBonus: true,
                        },
                        sub: true,
                        sourceSkill: "spflan_four",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "spflan_pohuai": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseEnd",
                },
                filter: function(event,player){
                    return !player.getStat('damage');
                },
                direct: true,
                content: function(){
                     'step 0'
                     player.chooseTarget(get.prompt2('spflan_pohuai'),true,function(card,player,target){
                         let dis = get.distance(player, target);
                         return player!=target&&game.filterPlayer(p => p != player).every(p => get.distance(player, p) >= dis);
                        }).ai=function(target){
                          return get.damageEffect(target,player,player);
                        }
                     'step 1'
                     if(result.bool){
                         player.logSkill('spflan_pohuai',result.targets[0]);
                         result.targets[0].damage();
                         player.loseHp();
                     }
                },
                ai: {
                    order: 8,
                    result: {
                        target: -1,
                    },
                },
                priority: -20,
                "_priority": -2000,
            },
            "ran_prophet": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseZhunbeiBegin",
                },
                content: function () {
                    var num = Math.min(5, game.countPlayer());
                    player.chooseToGuanxing(num);
                  },
                ai: {
                    order: 15,
                    threaten: 1.2,
                },
                "_priority": 0,
            },
            "ran_ei": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    global: "useCardToEnd",
                },
                direct: true,
                priority: 12,
                filter: function (event, player) {
                    if(player.storage.ran_ei_used == true) return false;
                    if (player == _status.currentPhase) return false;
                    if(get.name(event.card) == 'wuxie') return false;
                    if(get.name(event.card) == 'jiedao'&&event.target.hasEmptySlot(1))return false;
                    return event.target.isAlive()&&get.type(event.card) == 'trick'&&!event._neutralized;
                },
                content: function () {
                    "step 0"
                    player.chooseToDiscard('he','是否弃置1张牌，令'+get.translation(trigger.target)+'再次结算此符卡（此次的使用者视为你）？').set('logSkill','ran_ei').set('ai', function (card) {
                        if(trigger.getParent().excluded.contains(trigger.targets[0])) return 0;
                        //if(get.name(event.card) == 'wuzhong'&&ai.get.attitude(player,trigger.targets[0])>0){
                            //return 6-ai.get.value(card);
                        //}
                        if(ai.get.attitude(player,trigger.targets[0])<0){
                            return 6-ai.get.value(card);
                        }
                        return 0;
                    });
                    "step 1"
                    if(result.bool){
                        var next = trigger.player.useCard(trigger.card,trigger.target, false);
                        next.player = player;
                        next.animate = false;
                    //以下为重新使用整张卡牌
                    //var next = trigger.player.useCard(trigger.card,trigger.targets, false);
                    //next.player = player;
                    //next.targets = trigger.targets;
                    //next.animate = false;
                        player.storage.ran_ei_used = true;
                        player.unmarkSkill("ran_ei");
                    }
                    
                },
                mark: true,
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/ran_ei.png >",
                intro: {
                    content: "还可以发动极智",
                    onunmark: true,
                },
                ai: {
                    threaten: 1.3,
                    noautowuxie: true,
                },
                group: ["ran_ei_mark"],
                subSkill: {
                    mark: {
                        trigger: {
                            player: "phaseBegin",
                        },
                        firstDo: true,
                        direct: true,
                        content: function(){
                            player.storage.ran_ei_used = false;
                            if(!player.hasMark("ran_ei")){
                                player.markSkill("ran_ei");
                            }
                        },
                        sub: true,
                        sourceSkill: "ran_ei",
                        "_priority": 0,
                    },
                },
                "_priority": 1200,
            },
            "ran_suluo": {
                trigger: {
                    player: "damageBegin3",
                },
                direct: true,
                filter: function (event, player) {
                    if (event.name == "damage") {
                        return !player.countCards('h')&&event.card && get.type2(event.card) == "trick";
                    }
                },
                content: function () {
                    player.changeHujia();
                    //0点伤害本人无法实现，故以护甲值替代之
                    //trigger.num--;
                    game.log(trigger.player,"打出的符卡掉进了",player,"的毛茸茸的尾巴里，然后......就没有然后了。");
                },
                ai: {
                    noh: true,
                    notrick: function (player) {
                      return player.countCards('h') == 0;
                    },
                    skillTagFilter: function (player, tag) {
                        return player.countCards('h') == 1;
                    },
                },
                tag: {
                    damage: function (card) {
                        return 0;
                    },
                },
                "_priority": 0,
            },
            "rinnosuke_nitoru": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                filterCard: true,
                usable: 1,
                selectCard: 2,
                check: function(card) {
                    const player = get.owner(card);
                    if (player.countCards("h") > player.hp) return 8 - get.value(card);
                    if (player.hp < player.maxHp) return 6 - get.value(card);
                    return 4 - get.value(card);
                },
                filterTarget: function(card, player, target) {
                    if (target.hp >= target.maxHp) return false;
                    if (target == player) return false;
                    return true;
                },
                content: async function(event, trigger, player) {
                    player.recover();
                    event.target.recover();
                    game.log(player,"一改平日的猥琐形象，竟然用花言巧语将",event.target,"骗去啪啪啪了！");
                },
                ai: {
                    order: 5.5,
                    result: {
                        player: function(player) {
                            if (player.hp < player.maxHp) return 4;
                            if (player.countCards("h") > player.hp) return 0;
                            return -1;
                        },
                        target: 4,
                    },
                    threaten: 2,
                },
                "_priority": 0,
            },
            "rinnosuke_psycopath": {
                inherit: "xiaoji",
                audio: "ext:车万符斗祭:1",
                audioname: ["sp_sunshangxiang","re_sunshangxiang"],
                trigger: {
                    player: "loseAfter",
                    global: ["equipAfter","addJudgeAfter","gainAfter","loseAsyncAfter","addToExpansionAfter"],
                },
                forced: true,
                getIndex: function(event, player) {
                    const evt = event.getl(player);
                    if (evt && evt.player === player && evt.es) return evt.es.length;
                    return false;
                },
                content: async function(event, trigger, player) {
                    player.draw(2);
                    game.log(player,"满脸猥琐地将装备脱掉，结果众人抄起了2张牌糊在了他身上。");
                },
                ai: {
                    noe: true,
                    reverseEquip: true,
                    effect: {
                        target: function(card, player, target, current) {
                            if (get.type(card) == "equip" && !get.cardtag(card, "gifts")) return [1, 3];
                        },
                    },
                },
                "audioname2": {
                    "Mbaby_sp_sunshangxiang": "xiaoji_sp_sunshangxiang",
                },
                frequent: true,
                "_priority": 0,
                filter: function(event,player){
                    const evt=event.getl(player);
                    return evt&&evt.player==player&&evt.es&&evt.es.length>0;
                },
            },
            "cirno_bakadesu": {
                inherit: "tiaoxin",
                audio: "ext:车万符斗祭:1",
                audioname: ["sp_jiangwei","xiahouba","re_jiangwei","gz_jiangwei","ol_jiangwei"],
                "audioname2": {
                    "dc_xiahouba": "tiaoxin_xiahouba",
                },
                enable: "phaseUse",
                usable: 1,
                filterTarget: function(card, player, target) {
                    return target != player && target.inRange(player) && target.countCards("he") > 0;
                },
                content: async function(event, trigger, player) {
                    const target = event.target;
                    const { result } = await target
                        .chooseToUse(function (card, player, event) {
                            if (get.name(card) != "sha") return false;
                            return lib.filter.filterCard.apply(this, arguments);
                        }, "挑衅：对" + get.translation(player) + "使用一张杀，或令其弃置你的一张牌")
                        .set("targetRequired", true)
                        .set("complexSelect", true)
                        .set("filterTarget", function (card, player, target) {
                            if (target != _status.event.sourcex && !ui.selected.targets.includes(_status.event.sourcex)) return false;
                            return lib.filter.filterTarget.apply(this, arguments);
                        })
                        .set("sourcex", player);
                    if (result.bool == false && target.countCards("he") > 0) {
                        player.discardPlayerCard(target, "he", true);
                    }
                },
                ai: {
                    order: 4,
                    expose: 0.2,
                    result: {
                        target: -1,
                        player: function(player, target) {
                            if (target.countCards("h") == 0) return 0;
                            if (target.countCards("h") == 1) return -0.1;
                            if (player.hp <= 2) return -2;
                            if (player.countCards("h", "shan") == 0) return -1;
                            return -0.5;
                        },
                    },
                    threaten: 1.1,
                },
                "_priority": 0,
            },
            "cirno_perfectfreeze": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    source: "damageBegin2",
                },
                filter: function(event,player){
                    return event.card&&(event.card.name=='sha'||event.card.name=='juedou'||event.card.name=='houraitrick');
                },
                check: function(event,player){
                     if(event.player.hasSkillTag('noe')) return false;
                    var att=get.attitude(player,event.player);
                    if(trigger.player.countCards('he') == 0) return att<0;
                    return att>0;
                },
                logTarget: "player",
                content: function(){
                    "step 0"
                    trigger.cancel();
                    "step 1"
                    if(trigger.player.countCards('he') > 0){
                     trigger.player.chooseToDiscard(1,true);   
                    }
                    "step 2"
                     if(result.cards[0].original != 'e'){
                        trigger.player.loseHp();
                    }
                },
                ai: {
                    effect: {
                        player: function(card,player,target){
                            if(card.name=='sha'||card.name=='juedou'){
                                var ifao=game.hasPlayer(function(current){
                                    return current!=target&&get.attitude(target,current)>0&&current.hasSkillTag('recover');
                                });
                                var att=get.attitude(player,target);
                                if(ifao&&att>0) return [1,0,1,-0.5];
                            }
                        },
                    },
                },
                "_priority": 0,
            },
            houraijewel: {
                equipSkill: true,
                trigger: {
                    player: "useCardToPlayer",
                },
                check: function(event,player){
                    return get.attitude(player,event.target)<0;
                },
                filter: function (event,player){
                    if(event.card.name!='sha') return false;
                    return true;
                },
                logTarget: "target",
                content: function(){
                    trigger.card.name='houraitrick';
                    //trigger.getParent().excluded.add(trigger.target);
                    //trigger.player.chooseUseTarget({ name: 'horaitrick'}, true, 'nopopup', 'noanimate'); 
                },
                "_priority": -25,
            },
            "eirin_ts": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                filterTarget: function (card, player, target) {
                    return target.countCards("he") > 0;
                },
                check: function (card,target){
                        if(target.countCards("h") < target.hp) return false;
                },
                content: function(){
                    "step 0"
                    player.discardPlayerCard(target, true);
                    "step 1"
                    var list=["回复1点体力","展示牌堆底3张牌并获得其中的非基本牌"];
                    target.chooseControl().set('choiceList',list).set('ai',function(){
                        if(target.maxHp-target.hp>1) return 0;
                        return 1;
                    });
                    "step 2"
                    if(result.index==0){
                        player.recover();
                    }else{
                        "step 0"
                        event.cards=get.bottomCards(3);
                        game.cardsGotoOrdering(event.cards);
                        target.showCards(event.cards);
                        "step 1"
                        var gain=[];
                        var discard=[];
                        for(var i=0;i<event.cards.length;i++){
                            if(get.type(event.cards[i])!='basic'){
                                gain.push(event.cards[i]);
                            }
                            else{
                                discard.push(event.cards[i]);
                            }
                        }
                        if(gain.length) target.gain(gain,'draw');
                        if(discard.length) target.discard(discard);
                    }
                },
                ai: {
                    order: 9,
                    result: {
                        target: function(player, target) {
                            if (target.hp == 1) return 5;
                            if (player == target && player.countCards("h") > player.hp) return 5;
                            return 2;
                        },
                    },
                    threaten: 2,
                },
                "_priority": 0,
            },
            "chen_skanda": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "useCard2",
                },
                filter: function (event, player) { 
                    if(player.storage.chen_skanda == true) return false;
                    if(get.name(event.card)=='jiedao') return false;
                    if (get.type(event.card)=='trick' && event.targets.length == 1) {
                        return true;
                    }
                    return event.card.name == 'sha';
            //return game.hasPlayer(function(current){  
            //    return !event.targets.contains(current)&&player.canUse('sha',current); }); return true && game.hasPlayer(function (current) { return !trigger.targets.contains(current) && player.canUse('sha', current); }); 
                },
                direct: true,
                content: function () { 
                'step 0' 
                player.chooseTarget(get.prompt2('chen_skanda'), function (card, player, target) { 
                    var player=_status.event.player;
                    var evt=_status.event.getTrigger();
                return !evt.targets.includes(target)&&target!=player&&lib.filter.targetEnabled2(_status.event.card,player,target)&&lib.filter.targetInRange(_status.event.card,player,target);
                }).set('ai',function(target){
                var trigger=_status.event.getTrigger();
                var player=_status.event.player;
                return get.effect(target,trigger.card,player,player)*(_status.event.targets.includes(target)?-1:1);
                }).set('targets',trigger.targets).set('card',trigger.card);
                    //return !_status.event.source.contains(target) && player.canUse('sha', target); 
                //}).set('source', trigger.targets).set('ai', function (target) { 
                 //   var player = _status.event.player; 
                  //  return get.effect(target, { name: 'sha' }, player, player); 
                //});
                'step 1' 
                if (result.bool) { 
                    player.storage.chen_skanda = true;
                    if (!event.isMine() && !_status.connectMode) game.delayx(); 
                    event.target = result.targets[0]; 
                } else { event.finish(); } 
                'step 2' 
                player.logSkill('chen_skanda', event.target); 
                trigger.targets.push(event.target); },
                ai: {
                    effect: {
                        player: function (card, player, target) { 
                        if (card.name == 'sha') { if (target.hasSkillTag('nofire')) return; if (get.attitude(player, target) < 0) return [1, 0, 0, -0.5]; } },
                    },
                },
                group: "chen_skanda_end",
                subSkill: {
                    end: {
                        trigger: {
                            player: "phaseBefore",
                        },
                        direct: true,
                        content: function(){
                            player.storage.chen_skanda = false;
                        },
                        sub: true,
                        sourceSkill: "chen_skanda",
                        "_priority": 10,
                    },
                },
                "_priority": 0,
            },
            "parsee_envy": {
                audio: "ext:车万符斗祭:1",
                enable: "chooseToUse",
                filterCard: function(card){
                    return get.color(card)=='black';
                },
                position: "hes",
                viewAs: {
                    name: "guohe",
                },
                viewAsFilter: function(player){
                    if(!player.countCards('hes',{color:'black'})) return false;
                },
                prompt: "将一张黑色牌当城管执法使用",
                check: function(card){return 4-get.value(card)},
                ai: {
                    wuxie: (target,card,player,viewer,status)=>{
                        if(status*get.attitude(viewer,player._trueMe||player)>0 || target.hp>2&&!target.hasCard(i=>{
                            let val=get.value(i,target),subtypes=get.subtypes(i);
                            if(val<8&&target.hp<2&&!subtypes.includes('equip2')&&!subtypes.includes('equip5')) return false;
                            return val>3+Math.min(5,target.hp);
                        },'e')&&target.countCards('h')*_status.event.getRand('guohe_wuxie')>1.57) return 0;
                    },
                    basic: {
                        order: 9,
                        useful: (card,i)=>10/(3+i),
                        value: (card,player)=>{
                            let max=0;
                            game.countPlayer(cur=>{
                                max=Math.max(max,lib.card.guohe.ai.result.target(player,cur)*get.attitude(player,cur));
                            });
                            if(max<=0) return 5;
                            return 0.42*max;
                        },
                    },
                    yingbian: function(card,player,targets,viewer){
                        if(get.attitude(viewer,player)<=0) return 0;
                        if(game.hasPlayer(function(current){
                            return !targets.includes(current)&&lib.filter.targetEnabled2(card,player,current)&&get.effect(current,card,player,player)>0;
                        })) return 6;
                        return 0;
                    },
                    button: (button)=>{
                        let player = _status.event.player, target = _status.event.target;
                        if(!lib.filter.canBeDiscarded(button.link,player,target)) return 0;
                        let att = get.attitude(player, target),
                            val = get.buttonValue(button),
                            pos = get.position(button.link),
                            name = get.name(button.link);
                        if(pos==='j'){
                            if(name==='lebu'){
                                let needs=target.needsToDiscard(2);
                                val *= 1.08+0.2*needs;
                            }
                            else if(name=='shandian'||name=='fulei'||name=='plague') val /= 2;
                        }
                        if(get.attitude(player,get.owner(button.link))>0) val = -val;
                        if(pos!=='e') return val;
                        let sub = get.subtypes(button.link);
                        if(sub.includes('equip1')) return val*Math.min(3.6,target.hp)/3;
                        if(sub.includes('equip2')){
                            if(name==='baiyin'&&pos==='e'&&target.isDamaged()){
                                let by=3-0.6*Math.min(5,target.hp);
                                return get.sgn(get.recoverEffect(target,player,player))*by;
                            }
                            return 1.57*val;
                        }
                        if(att<=0&&(sub.includes('equip3')||sub.includes('equip4'))&&(player.hasSkill('shouli')||player.hasSkill('psshouli'))) return 0;
                        if(sub.includes('equip6')) return val;
                        if(sub.includes('equip4')) return val/2;
                        if(sub.includes('equip3')&&!game.hasPlayer((cur)=>{
                            return !cur.inRange(target)&&get.attitude(cur,target)<0;
                        })) return 0.4*val;
                        return val;
                    },
                    result: {
                        target: function(player,target){
                            let att=get.attitude(player, target),
                                hs=target.countCards('h',(card)=>lib.filter.canBeDiscarded(card,player,target)),
                                es=target.countCards('e',(card)=>lib.filter.canBeDiscarded(card,player,target)),
                                js=target.countCards('j',(card)=>lib.filter.canBeDiscarded(card,player,target)),
                                noh=!hs||target.hasSkillTag('noh'),
                                noe=!es||target.hasSkillTag('noe'),
                                check=[-1,att>0?-1.3:1.3,att>0?-2.5:2.5],
                                idx=-1;
                            if(hs){
                                idx=0;
                                if(noh) check[0]=0.7;
                            }
                            if(es){
                                if(idx<0) idx=1;
                                if(target.getEquip('baiyin')&&target.isDamaged()&&lib.filter.canBeDiscarded(target.getEquip('baiyin'),player,target)){
                                    let rec=get.recoverEffect(target,player,target);
                                    if(es==1||att*rec>0){
                                        let val=3-0.6*Math.min(5,target.hp);
                                        if(rec>0) check[1]=val;
                                        else if(rec<0) check[1]=-val;
                                    }
                                }
                                target.countCards('e',function(card){
                                    let val=get.value(card,target);
                                    if(card.name=='jinhe'||att*val>=0||!lib.filter.canBeDiscarded(card,player,target)) return false;
                                    if(att>0){
                                        check[1]=Math.max(1.3,check[1]);
                                        return true;
                                    }
                                    let sub=get.subtype(card);
                                    if(sub=='equip2'||sub=='equip5') val+=4;
                                    else if(sub=='equip1') val*=0.4*Math.min(3.6,target.hp);
                                    else val*=0.6;
                                    if(target.hp<3&&sub!='equip2'&&sub!='equip5') val*=0.4;
                                    check[1]=Math.min(-0.16*val,check[1]);
                                });
                                if(noe) check[1]+=0.9;
                            }
                            if(js){
                                let func=function(num){
                                    if(att>0) check[2]=Math.max(check[2],num);
                                    else check[2]=Math.min(check[2],0.6-num);
                                };
                                if(idx<0) idx=2;
                                target.countCards('j',function(card){
                                    let cardj=card.viewAs?new lib.element.VCard({name:card.viewAs}):card;
                                    if(!lib.filter.canBeDiscarded(card,player,target)||att*get.effect(target,cardj,target,target)>=0) return false;
                                    if(cardj.name=='lebu') func(2.1+0.4*target.needsToDiscard(2));
                                    else if(cardj.name=='bingliang') func(2.4);
                                    else if(cardj.name=='shandian'||cardj.name=='fulei'||cardj.name=='plague') func(Math.abs(check[2])/(1+target.hp));
                                    else func(2.1);
                                });
                            }
                            if(idx<0) return 0;
                            for(let i=idx+1;i<3;i++){
                                if(i==1&&!es||i==2&&!js) continue;
                                if(att>0&&check[i]>check[idx]||att<=0&&check[i]<check[idx]) idx=i;
                            }
                            return check[idx];
                        },
                    },
                    tag: {
                        loseCard: 1,
                        discard: 1,
                    },
                },
                group: ["parsee_envy_diamond"],
                subSkill: {
                    diamond: {
                        trigger: {
                            global: "discardAfter",
                        },
                        direct: true,
                        filter: function (event, player) {
                            if(event.player ==player) return false;
                            if(get.distance(player,event.player)>1) return false;
                        for (var i = 0; i < event.cards.length; i++) {
                            if (get.suit(event.cards[i]) == 'diamond') return true;
                        } return false; },
                        logTarget: "player",
                        check: function (event, player) { 
                            for (var i = 0; i < event.cards.length; i++) {
                                if (get.suit(event.cards[i]) == 'diamond') 
                                    return get.value(event.cards[i]);
                            } 
                            return 0;
                        },
                        content: function () {
                            "step 0"
                            player.chooseBool("是否获得"+get.translation(trigger.cards)+"？")
                            "step 1"
                            if(result.bool){
                            for (var i = 0;
                                 i < trigger.cards.length; i++) {
                                if (get.suit(trigger.cards[i]) == 'diamond') {
                                    player.gain(trigger.cards[i], trigger.player, 'giveAuto');
                                }
                            }}
                        },
                        sub: true,
                        sourceSkill: "parsee_envy",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "chen_shikigami": {
                audio: "ext:车万符斗祭:1",
                unique: true,
                enable: "phaseUse",
                intro: {
                    content: "limited",
                },
                init: function (player, skill) {
                    player.storage[skill] = false;
                },
                filterTarget: function (card, player, target) {
                    return player != target;
                },
                content: function () {
                    "step 0";
                    if (!player.storage.chen_shikigami) {
                        player.awakenSkill("chen_shikigami");
                        player.storage.chen_shikigami = true;
                    }
                    var list = ["摸两张牌","回复1点体力"];
                    if (!target.isDamaged()) {
                        target.draw(2);
                        event.goto(2);
                    }
                    else {
                        target.chooseControl(list).set("prompt","请选择一项：").set("ai",function(){
                            if (target.getCards('h') > target.hp && target.hp < 2 ){
                                return "回复1点体力";
                            }
                            return list.randomGet();
                        });
                    }
                    "step 1";
                    if (result.control == '摸两张牌') {
                        target.draw(2);
                    }
                    else {
                        target.recover();
                    }
                    "step 2"
                    player.addSkill("chen_shikigami1");
                    target.addSkill("chen_shikigami2");
                },
                ai: {
                    order: 9,
                    result: {
                        target: function (player, target) {
                            var num = get.attitude(player, target);
                            if (num > 0 && target.hp <= 2) {
                                if (target.maxHp - target.hp < 2) {
                                    num += 3;
                                } else {
                                    num += 6;
                                }
                            }
                            return num;
                        },
                    },
                },
                "_priority": 0,
            },
            "eirin_medic": {
                enable: ["chooseToUse","chooseToRespond"],
                hiddenCard: function (player) {
                    return player.countCards('h');
                  },
                filter: function (event, player) {
                    if (!player.countCards('h')) return false;
                    for (var i of lib.inpile) {
                      if (i == 'sha' && lib.inpile_nature.some(nat => event.filterCard({ name: i, nature: nat }, player, event))) {
                        return true;
                      }
                    }
                    return false;
                  },
                chooseButton: {
                    dialog: function(event, player) {
                        var vcards = [];
                        for (var name of ["sha"]) {
                            var card = { name: name, isCard: true };
                            if (event.filterCard(card, player, event)) vcards.push(["基本", "", name]);
                        }
                        const dialog = ui.create.dialog("月弦", [vcards, "vcard"], "hidden");
                        dialog.direct = true;
                        return dialog;
                    },
                    filter: function (button, player) {
                      var evt = _status.event.getParent();
                      return evt.filterCard({ name: button.link[2], nature: button.link[3] }, player, evt);
                    },
                    check: function(button) {
                        return 1;
                    },
                    backup: function (links, player) {
                      return {
                        filterCard:true,
                        position:'h',
                        audio: "none",
                        popname: true,
                        discard:false,
                        loseTo: "cardPile",
                        insert: true,
                        // ignoreMod:true,
                        viewAs: {
                          name: links[0][2],
                          nature: links[0][3],
                          number: "none",
                          isCard: true,
                        },
                        ai1: function (card) {
                          return 6 - get.value(card);
                        },
                        precontent:async function(event, trigger, player) {
                            const { result: { control } } = await player.chooseControl('牌堆顶', '牌堆底')
                            .set('prompt','将一张手牌置于')
                            .set('ai', function(){
                                if(Math.random()<0.6) return '牌堆底';
                                return '牌堆顶';
                            });
                            var card = event.result.cards[0];
                            event.card = card;
                            player.$throw(card, 1000);
                            player.lose(card,ui.cardPile);
                        if (control == '牌堆顶') {
                            event.result.cards = [];
                            game.log("阴谋！有人注意到牌堆上面的牌变了吗？");
                            ui.cardPile.insertBefore(card, ui.cardPile.firstChild);
                            game.updateRoundNumber();
                        }
                        else {
                            event.result.cards = [];
                            game.log("阴谋！有人注意到牌堆好像比原来高了一点吗？");
                            ui.cardPile.appendChild(card);
                            game.updateRoundNumber();
                        }
                        },
                      };
                    },
                },
                "_priority": 0,
            },
            "old_medic": {
                enable: "chooseToRespond",
                filter: function (event,player){
                    if(event.responded) return false;
                    if(!event.filterCard||!event.filterCard({name:'sha'},player,event)) return false;
                    if(event.name=='chooseToRespond'&&!lib.filter.cardRespondable({name:'sha'},player,event)) return false;
                    var hs = _status.currentPhase.getCards('h');
                    if(hs.length<=0) return false;
                    return true;
                },
                filterCard: true,
                prepare: function (cards,player){
                    player.$throw(cards,1000);
                },
                popname: true,
                discard: false,
                loseTo: "cardPile",
                insert: true,
                position: "h",
                content: function (){
                    "step 0"
                    event.cardss=cards[0];
                    player.chooseControl('牌堆顶','牌堆底').set('ai',function(){
                        var player=_status.event.player;
                        if(Math.random()<0.6) return '牌堆底';
                        return '牌堆顶';
                    });
                    "step 1"
                    if(result.control=='牌堆顶'){
                        ui.cardPile.insertBefore(event.cardss,ui.cardPile.firstChild);
                    }
                    else{
                        ui.cardPile.appendChild(event.cardss);
                    }
                    game.log(player, "将", cards[0], "置于牌堆" + ((result.control == "牌堆顶" )?"顶：阴谋！有人注意到牌堆上面的牌变了吗？":"底：阴谋！有人注意到牌堆好像比原来高了一点吗？"));
                },
                ai: {
                    yingbian: function (card, player, targets, viewer) {
                        if (get.attitude(viewer, player) <= 0) return 0;
                        var base = 0,
                            hit = false;
                        if (get.cardtag(card, "yingbian_hit")) {
                            hit = true;
                            if (
                                targets.some(target => {
                                    return (
                                        target.mayHaveShan(
                                            viewer,
                                            "use",
                                            target.getCards("h", i => {
                                                return i.hasGaintag("sha_notshan");
                                            })
                                        ) &&
                                        get.attitude(viewer, target) < 0 &&
                                        get.damageEffect(target, player, viewer, get.natureList(card)) > 0
                                    );
                                })
                            )
                                base += 5;
                        }
                        if (get.cardtag(card, "yingbian_add")) {
                            if (
                                game.hasPlayer(function (current) {
                                    return !targets.includes(current) && lib.filter.targetEnabled2(card, player, current) && get.effect(current, card, player, player) > 0;
                                })
                            )
                                base += 5;
                        }
                        if (get.cardtag(card, "yingbian_damage")) {
                            if (
                                targets.some(target => {
                                    return (
                                        get.attitude(player, target) < 0 &&
                                        (hit ||
                                            !target.mayHaveShan(
                                                viewer,
                                                "use",
                                                target.getCards("h", i => {
                                                    return i.hasGaintag("sha_notshan");
                                                })
                                            ) ||
                                            player.hasSkillTag(
                                                "directHit_ai",
                                                true,
                                                {
                                                    target: target,
                                                    card: card,
                                                },
                                                true
                                            )) &&
                                        !target.hasSkillTag("filterDamage", null, {
                                            player: player,
                                            card: card,
                                            jiu: true,
                                        })
                                    );
                                })
                            )
                                base += 5;
                        }
                        return base;
                    },
                    canLink: function(player, target, card) {
                        if (!target.isLinked() && !player.hasSkill("wutiesuolian_skill")) return false;
                        if (player.hasSkill("jueqing") || player.hasSkill("gangzhi") || target.hasSkill("gangzhi")) return false;
                        let obj = {};
                        if (get.attitude(player, target) > 0 && get.attitude(target, player) > 0) {
                            if (
                                (player.hasSkill("jiu") ||
                                    player.hasSkillTag("damageBonus", true, {
                                        target: target,
                                        card: card,
                                    })) &&
                                !target.hasSkillTag("filterDamage", null, {
                                    player: player,
                                    card: card,
                                    jiu: player.hasSkill("jiu"),
                                })
                            )
                                obj.num = 2;
                            if (target.hp > obj.num) obj.odds = 1;
                        }
                        if (!obj.odds)
                            obj.odds =
                                1 -
                                target.mayHaveShan(
                                    player,
                                    "use",
                                    target.getCards("h", i => {
                                        return i.hasGaintag("sha_notshan");
                                    }),
                                    "odds"
                                );
                        return obj;
                    },
                    basic: {
                        useful: [5,3,1],
                        value: [5,3,1],
                    },
                    order: function(item, player) {
                        let res = 3.2;
                        if (player.hasSkillTag("presha", true, null, true)) res = 10;
                        if (typeof item !== "object" || !game.hasNature(item, "linked") || game.countPlayer(cur => cur.isLinked()) < 2) return res;
                        //let used = player.getCardUsable('sha') - 1.5, natures = ['thunder', 'fire', 'ice', 'kami'];
                        let uv = player.getUseValue(item, true);
                        if (uv <= 0) return res;
                        let temp = player.getUseValue("sha", true) - uv;
                        if (temp < 0) return res + 0.15;
                        if (temp > 0) return res - 0.15;
                        return res;
                    },
                    result: {
                        target: function (player, target, card, isLink) {
                            let eff = -1.5,
                                odds = 1.35,
                                num = 1;
                            if (isLink) {
                                eff = isLink.eff || -2;
                                odds = isLink.odds || 0.65;
                                num = isLink.num || 1;
                                if (
                                    num > 1 &&
                                    target.hasSkillTag("filterDamage", null, {
                                        player: player,
                                        card: card,
                                        jiu: player.hasSkill("jiu"),
                                    })
                                )
                                    num = 1;
                                return odds * eff * num;
                            }
                            if (
                                player.hasSkill("jiu") ||
                                player.hasSkillTag("damageBonus", true, {
                                    target: target,
                                    card: card,
                                })
                            ) {
                                if (
                                    target.hasSkillTag("filterDamage", null, {
                                        player: player,
                                        card: card,
                                        jiu: player.hasSkill("jiu"),
                                    })
                                )
                                    eff = -0.5;
                                else {
                                    num = 2;
                                    if (get.attitude(player, target) > 0) eff = -7;
                                    else eff = -4;
                                }
                            }
                            if (
                                !player.hasSkillTag(
                                    "directHit_ai",
                                    true,
                                    {
                                        target: target,
                                        card: card,
                                    },
                                    true
                                )
                            )
                                odds -=
                                    0.7 *
                                    target.mayHaveShan(
                                        player,
                                        "use",
                                        target.getCards("h", i => {
                                            return i.hasGaintag("sha_notshan");
                                        }),
                                        "odds"
                                    );
                            _status.event.putTempCache("sha_result", "eff", {
                                bool: target.hp > num && get.attitude(player, target) > 0,
                                card: ai.getCacheKey(card, true),
                                eff: eff,
                                odds: odds,
                            });
                            return odds * eff;
                        },
                    },
                    tag: {
                        respond: 1,
                        respondShan: 1,
                        damage: function (card) {
                            if (game.hasNature(card, "poison")) return;
                            return 1;
                        },
                        natureDamage: function (card) {
                            if (game.hasNature(card, "linked")) return 1;
                        },
                        fireDamage: function (card, nature) {
                            if (game.hasNature(card, "fire")) return 1;
                        },
                        thunderDamage: function (card, nature) {
                            if (game.hasNature(card, "thunder")) return 1;
                        },
                        poisonDamage: function (card, nature) {
                            if (game.hasNature(card, "poison")) return 1;
                        },
                        "jy_xieDamage": function(card,naturex){
                            if(game.hasNature(card,'jy_xie')) return 1;
                        },
                        "jy_duDamage": function(card,naturex){
                            if(game.hasNature(card,'jy_du')) return 1;
                        },
                    },
                },
                "_priority": 0,
            },
            "nitori_craftsman": {
                subSkill: {
                    used: {
                        sub: true,
                        sourceSkill: "nitori_craftsman",
                        "_priority": 0,
                    },
                    graze: {
                        audio: "ext:车万符斗祭:1",
                        sub: true,
                        sourceSkill: "nitori_craftsman",
                        "_priority": 0,
                    },
                },
                audio: "ext:车万符斗祭:2",
                enable: ["chooseToUse","chooseToRespond"],
                hiddenCard: function(player,name){
                    if(!['sha','shan','tao','jiu'].includes(name)) return false;
                    return player.countCards('h');
                },
                locked: false,
                mod: {
                    aiOrder: function(player,card,num){
                        var name=get.name(card);
                        if(name!="sha"&&name!="jiu") return num+4;
                        return num;
                    },
                },
                filter: function(event,player){
                    if(!player.countCards('h')||player.hasSkill("nitori_craftsman_used")) return false;
                    var list=[
                        {name:'sha'},
                        {name:'shan'},
                        {name:'tao'},
                        {name:'jiu'},
                    ];
                    for(var j of lib.inpile_nature){
                        list.push({name:'sha',nature:j});
                    };
                    for(var i of list){
                        if(event.filterCard(i,player,event)){
                            return true;
                        };
                    };
                    return false;
                },
                chooseButton: {
                    dialog: function(event,player){
                        var list=[];
                        var list2=[
                            {name:'sha'},
                            {name:'shan'},
                            {name:'tao'},
                            {name:'jiu'},
                        ];
                        for(var j of lib.inpile_nature){
                            list2.push({name:'sha',nature:j});
                        };
                        for(var i of list2){
                            if(event.filterCard(i,player,event)){
                                if(i.name=='sha'&&i.nature){
                                    list.push(['基本','',i.name,i.nature]);
                                }else{
                                    list.push(['基本','',i.name]);
                                };
                            };
                        };
                        return ui.create.dialog('匠心',[list,'vcard'],'hidden');
                    },
                    check: function(button){
                        var player=_status.event.player;
                        var evt=_status.event.getParent();
                        if(player.countCards('h',button.link[2])) return -1;
                        if(player.countCards('h','tao')) return -1;
                        var buff=player.hasSkillTag('taiJiBuff');
                        var count=player.countCards('h');
                        if(evt.type=='dying'){
                            if(count>3&&!buff) return -1;
                        }
                        else{
                            if(count>2&&!buff) return -1;
                        };
                        var card={name:button.link[2],nature:button.link[3]};
                        if(evt.type=='dying'){
                            var num=get.effect(evt.dying,card,player,player);
                            if(num>0) return get.order(card)-0.1;
                            return -1;
                        }
                        else if(card.name=='shan'||evt.name=='chooseToRespond'){
                            if(evt&&(evt.ai||evt.ai1)){
                                var tmp=_status.event;
                                _status.event=evt;
                                var result=(evt.ai||evt.ai1)(card,player,evt);
                                _status.event=tmp;
                                return result;
                            };
                            return -1;
                        }
                        else if(card.name!='jiu'&&player.getUseValue(card)>0){
                            return get.order(card);
                        };
                        return -1;
                    },
                    backup: function(links,player){
                        return{
                            audio:'nitori_craftsman',
                            filterCard:function(){return false},
                            complexCard:true,
                            selectCard:-1,
                            position:"h",
                            viewAs:{name:links[0][2],nature:links[0][3],isCard:true},
                            popname:true,
                            ignoreMod:true,
                            precontent:function(){
                                delete event.result.skill;
                                event.result.card={
                                    name:event.result.card.name,
                                    nature:event.result.card.nature,
                                    isCard:true,
                                };
                                event.result.cards=[];
                                if(player.hp < 1 || event.result.card.name!="sha")
                                {player.logSkill('nitori_craftsman_graze');}
                                else
                                {player.logSkill('nitori_craftsman');}
                                player.discard(player.getCards('h'));
                                if(player.isPhaseUsing()){player.addTempSkill("nitori_craftsman_used","phaseEnd")}
                            },
                        };
                    },
                    prompt: function(links,player){
                        return '弃置全部手牌并视为使用一张'+get.translation(links[0][3]||'')+get.translation(links[0][2]);
                    },
                },
                ai: {
                    order: function(skill,player){
                        return 1;
                        /*
                        var evt=_status.event;
                        player=player||evt.player;
                        if(player.countCards('h','tao')) return -1;
                        if(evt.type=='dying'){
                            if(get.attitude(player,evt.dying)<=0) return -1;
                        }
                        var list=[
                            {name:'sha'},
                            {name:'shan'},
                            {name:'tao'},
                            {name:'jiu'},
                        ];
                        for(var j of lib.inpile_nature){
                            list.push({name:'sha',nature:j});
                        }
                        var max=-1;
                        for(var i of list){
                            if(!player.countCards('h',i.name)&&evt.filterCard(i,player,evt)){
                                if(evt&&(evt.ai||evt.ai1)){
                                    var result=(evt.ai||evt.ai1)(i,player,evt);
                                    if(i.name=='jiu'&&evt.type!='dying'&&evt.name=='chooseToUse') result=-1;
                                    //牌都弃光了喝酒喝个寂寞//
                                    if(result>max) max=result;
                                };
                            };
                        };
                        var buff=player.hasSkillTag('taiJiBuff');
                        var count=player.countCards('h');
                        if(evt.type=='dying'){
                            if(count>3&&!buff) max=-10;
                        }else{
                            if(count>2&&!buff) max=-10;
                        }
                        return max-0.2;
                        */
                    },
                    skillTagFilter: function(player,tag,arg){
                        if(tag=='fireAttack') return true;
                        if(tag=='nokeep') return true;
                        if(tag=='pretao') return true;
                        if(!player.countCards('h')) return false;
                        return true;
                    },
                    result: {
                        player: function(player){
                            if(_status.event.dying){
                                if(get.attitude(player,_status.event.dying)<=0) return -1;
                            }
                            return 1;
                        },
                    },
                    save: true,
                    respondSha: true,
                    respondShan: true,
                    fireAttack: true,
                    nokeep: true,
                },
                "_priority": 0,
            },
            "nitori_dismantle": {
                ai: {
                    threaten: 1.2,
                    order: 12,
                    result: {
                        target: -1,
                    },
                },
                enable: "phaseUse",
                usable: 1,
                filterTarget: function (card,player,target){
                    return target!=player&&target.countCards('e')>0;
                },
                content: function(){
                    'step 0'
                    if(get.attitude(player, target) < 0) {game.playAudio("../extension/车万符斗祭/",'nitori_dismantle1');}
                    else {game.playAudio("../extension/车万符斗祭/",'nitori_dismantle_other1');}
                    "step 1"
                    player.choosePlayerCard('拆解',target,'e',true,'visible')
                    .set("filterButton", function (button) {
                        const card=button.link;
                        const target=_status.event.target;
                        return 1;
                    });
                    'step 2'
                    //target.recast(result.cards);
                     if(result.bool){
                        var card=result.cards[0];
                         //card.excluded=true;
                         //card.fix();
                         //target.lose(card,ui.special);
                         //ui.discardPile.appendChild(card);
                         target.$throw(card);
                         target.lose(card, ui.discardPile);
                         game.cardsDiscard(card).fromDeletable = false;
                         //card.discard();
                    //target.lose(result.cards,true);
                         target.draw();
                     }
                    "step 3"
                    //player.discard(card);
                    player.draw();
                },
                "_priority": 0,
            },
            "恶心丸测试": {
                trigger: {
                    player: "discardAfter",
                },
                direct: true,
                filter: function (event,player){
                    for(var i=0;i<event.cards.length;i++){
                        if(get.position(event.cards[i])=='d'){
                            return event.cards[i].name=='tao';
                        }
                    }
                    return false;
                },
                content: function (){
                    "step 0"
                    event.numx = 0;
                    for(var i=0;i<trigger.cards.length;i++){
                        if(get.position(trigger.cards[i])=='d'&&trigger.cards[i].name=='tao'){
                            event.numx++;
                        }
                    }
                    var next=player.chooseToDiscard(2,'h','请弃置两张手牌,否则受到一点无来源伤害。');
                    next.set('ai',function(card){
                        var player=_status.event.player;
                        if(player.hp==1) return 8-get.value(card);
                        if(player.hp==2) return 7-get.value(card);
                        return 6-get.value(card);
                    });
                    "step 1"
                    if(!result.bool){
                        player.damage('nosource');
                    }
                    "step 2"
                    if(event.numx >= 1){
                        event.numx--;
                        event.goto(1);
                    }
                },
                "_priority": 0,
            },
            "shinmyoumaru_venge_old": {
                audio: "ext:车万符斗祭:2",
                trigger: {
                    global: "discardAfter",
                },
                direct: true,
                filter: function (event, player) {
                    //["loseAfter","equipAfter","addJudgeAfter","gainAfter","loseAsyncAfter","addToExpansionAfter"],
                    //if (event.player == player) return false;
                    //return game.hasPlayer(p => {
                      //var evt = event.getl(p);
                      //return evt && evt.es && evt.es.length > 0;
                   // }
                   // );
                    if(event.player==player) return false;
                    for(var i=0;i<event.cards.length;i++){
                        var current=event.cards[i];
                        while(current.pos!='d'){
                            current=current.previous;
                        }
                        if(event.cards[i].original=='e') return true;
                    }
                  },
                content: function () {
                    'step 0'
                    event.players = game.filterPlayer(p => {
                      var evt = trigger.getl(p);
                      return evt && evt.es && evt.es.length > 0;
                    });
                    'step 1'
                    event.target = event.players.shift();
                    if (!event.target) {
                      event.finish();
                      return;
                    }
                    var evt = trigger.getl(event.target);
                    event.num = evt && evt.es && evt.es.length;
                    'step 2'
                    if (!event.num) { // next target
                      event.goto(1);
                      return;
                    }
                    --event.num;
                    player.chooseBool(get.prompt2('shinmyoumaru_venge', (player != event.target) ? event.target : undefined))
                      .set('choice', get.attitude(player, event.target) < 0);
                    'step 3'
                    if (result.bool) {
                      player.logSkill('shinmyoumaru_venge', event.target);
                        event.goto(4);
                    } else {
                      event.goto(1);
                    }
                    'step 4'
                    player.judge(function (card) {
                      if (get.number(card) > 8) return 2;
                      return -2;
                    }).judge2 = result => result.bool;
                    'step 5'
                    if (result.bool) {
                      event.target.damage();
                    }
                    event.goto(2);
                  },
                ai: {
                    threaten: 2,
                    order: 10,
                    result: {
                        target: -1,
                    },
                },
                "_priority": 0,
            },
            "shinmyoumaru_venge": {
                audio: "ext:车万符斗祭:2",
                trigger: {
                    global: "discardBefore",
                },
                filter: function (event, player) {
                    if (event.player.isDead()) return false;
                    if (event.player == player) return false;
                    for (var i = 0; i < event.cards.length; i++) {
                        if (get.type(event.cards[i]) == "equip" && get.position(event.cards[i]) == "e") {
                            return true;
                        }
                    }
                    return false;
                },
                direct: true,
                content: function () {
                    "step 0";
                    if (trigger.delay == false) game.delay();
                    "step 1";
                    var num = 0;
                    for (var i = 0; i < trigger.cards.length; i++) {
                        if (get.type(trigger.cards[i]) == "equip") {
                            num++;
                        }
                    }
                    event.num = num;
                    "step 2";
                    player.chooseBool("是否对" + get.translation(trigger.player) + "发动【付丧神之怨】？").ai =
                        function () {
                            return get.attitude(player, trigger.player) < 0;
                        };
                    "step 3";
                    if (result.bool) {
                        player.logSkill("shinmyoumaru_venge", trigger.player);
                        player.judge(function (card) {
                            if (get.number(card) > 8) return 2;
                            return -2;
                        }).judge2 = result => result.bool;
                    } else {
                        event.goto(5);
                    }
                    "step 4"
                    if (result.bool) {
                      trigger.player.damage();
                    }
                    "step 5";
                    if (event.player.isAlive())
                        {
                            event.num--; 
                        }else event.finish();
                    if (event.num > 0) {
                        event.goto(2);
                    }
                },
                ai: {
                    expose: 0.2,
                    threaten: 1.5,
                },
                "_priority": 0,
            },
            exin: {
                trigger: {
                    global: "discardAfter",
                },
                forced: true,
                filter: function (event,player){
                    if(!event.cards) return false;
                    for(var i=0;i<event.cards.length;i++){
                        if(event.cards[i].name=='1') return get.triggerer()==player?false:true;
                    }
                    return false;
                },
                content: function (){
                    "step 0"
                    player.line(trigger.player,'green');
                    trigger.player.chooseToDiscard(2,'he','请弃置两张牌，否则受到一点无来源伤害',function(card,player){
                        return true;
                    }).set('ai',function(target){
                        return -get.value(card);
                    });
                    "step 1"
                    if(result.bool==false){
                        trigger.player.damage(1,'nosource');        
                    } 
                },
                "_priority": 0,
            },
            "ibukigourd_old": {
                equipSkill: true,
                trigger: {
                    player: "phaseEnd",
                },
                filter: function(event,player){
                    return !player.getStat('damage');
                },
                direct: true,
                content: function(){
                    var next=trigger.player.useCard({ name: 'jiu',isCard: false},target, true);
                    next.animate=false;
                    next.audio=false;
                    //player.chooseUseTarget({ name: 'jiu', isCard: false}, true, false, 'nopopup','noanimate').set('logSkill','nolog');
                },
                group: "ganjin_hejiu",
                "_priority": -25,
            },
            ibukigourd: {
                equipSkill: true,
                trigger: {
                    player: "phaseEnd",
                },
                filter: function(event,player){
                    return !player.getStat('damage');
                },
                direct: true,
                content: function(){
                    player.addSkill("hezui");
                    //player.addTempSkill("hezui", { player: "phaseBefore" });
                    game.log(player, "喝醉了。。。" );
                },
                "_priority": -25,
            },
            "ganjin_old": {
                trigger: {
                    player: "phaseZhunbeiAfter",
                },
                fixed: true,
                Yx: true,
                direct: true,
                change: function (player, num) {
                    if (!player.storage.ganjin) player.storage.ganjin = 0;
                    if (!num) return;
                    player.storage.ganjin = 1;
                    player.markSkill("ganjin");
                },
                content: function () {
                    lib.skill.ganjin.change(player, 1);
                    game.log(player,'获得了一点干劲。');
                },
                onremove: true,
                mod: {
                    cardUsable: function (card,player,num){
                        if(card.name=='sha'&&(player.storage.ganjin==0)&&!player.getEquip('zhuge','rewrite_zhuge')) return 0;
                        return Infinity;
                    },
                },
                group: ["ganjin_hejiu","ganjin_yanhui","ganjin_chongzhu","ganjin_shaAfter","ganjin_tired","ganjin_zhuSkill","upgrade"],
                subSkill: {
                    hejiu: {
                        mod: {
                            cardUsable: function (card, player) {
                                if (card.name == "jiu" &&! player.isDying()) {
                                    return Infinity;
                                }
                            },
                            cardSavable: function (card, player) {
                                if (card.name == "jiu") return false;
                            },
                        },
                        trigger: {
                            player: "useCardToPlayered",
                        },
                        check: function (event, player) { 
                    return player.hp == 1 &&player.countCards('h', 'jiu');
                        },
                        filter: function (event, player) {
                            return event.card && event.card.name == 'jiu';
                        },
                        forced: true,
                        content: function () {
                            "step 0"
                            delete player.storage.jiu;
                            //trigger.getParent().excluded.add(player);
                            //game.delay(0.5);
                            "step 1"
                            player.addSkill('hezui');
                            game.log(player, "喝醉了。。。" );
                        },
                        Yx: true,
                        direct: true,
                        ai: {
                            jiuSustain: true,
                            result: {
                                target: (player, target, card) => {
                                    if (!target.hasSkill('hezui')) return 2;
                                    let usable = target.getCardUsable("sha");
                                    if (
                                        !usable ||
                                        (!player.isMin() &&
                                            player.getActCount() + 1 >= player.actcount) ||
                                        !target.mayHaveSha(player, "use", card)
                                    )
                                        return 0;
                                },
                            },
                            order: 4,
                        },
                        sub: true,
                        sourceSkill: "ganjin_old",
                        "_priority": 0,
                    },
                    yanhui: {
                        filter: function (event, player) {
                            return event.card.name == "taoyuan";
                        },
                        trigger: {
                            target: "useCardToTargeted",
                        },
                        Yx: true,
                        direct: true,
                        content: function () {
                            if (player.hp == player.maxHp){
                                trigger.getParent().excluded.add(player);
                                player.chooseUseTarget({ name: 'jiu'}, true, false, 'nopopup','noanimate').set('logSkill','nolog');
                                player.addSkill('hezui');
                                game.log(player, "喝醉了。。。" );
                            }
                                else event.finish();
                        },
                        sub: true,
                        sourceSkill: "ganjin_old",
                        "_priority": -20,
                    },
                    chongzhu: {
                        trigger: {
                            player: "equipBefore",
                        },
                        filter: function (event,player) {
                            return get.subtype(event.card) == 'equip1' && player.storage.ganjin != 0;
                        },
                        direct: true,
                        content: function () {
                            "step 0"
                            var equipValue = get.equipValue(trigger.card, player);
                            player
                            .chooseControl("重铸", "继续装备")
                            .set("prompt", "装备" + get.translation(trigger.card))
                            .set("prompt2","你即将装备" + get.translation(trigger.card) + "，是否重铸该武器并失去一点干劲？")
                                 //"是否重铸" + get.translation(trigger.card) + "？或者继续装备" + get.translation(trigger.card)+ "." + "当前值：" + equipValue + "\n")
                            .set("ai", function () {
                                var player = _status.event.player;
                                var trigger = _status.event.getTrigger();
                                if (get.equipValue(trigger.card, player) > 1) return "继续装备";
                               return "重铸";
                            });
                            "step 1"
                            if (result.control == "重铸") {
                                trigger.cancel();
                                var card = trigger.card;
                                player.recast(card);
                                player.storage.ganjin -= 1;
                                game.log(player,'失去了一点干劲。');
                                if(player.storage.ganjin == 0){
                                player.addSkill("ganjin_tired");
                                }
                            } else {
                                event.finish();    
                            }
                        },
                        sub: true,
                        sourceSkill: "ganjin_old",
                        "_priority": 0,
                    },
                    shaAfter: {
                        Yx: true,
                        direct: true,
                        trigger: {
                            player: ["useCard1"],
                        },
                        filter: function (event, player) {
                    return _status.currentPhase == player && event.card.name == 'sha';
                        },
                        content: function () {
                            if(_status.currentPhase == player&&(player.storage.ganjin != 0)&&!player.getEquip('zhuge','rewrite_zhuge')){
                                player.storage.ganjin -= 1;
                                game.log(player,'失去了一点干劲。');}
                            if(player.storage.ganjin == 0){
                                player.addSkill("ganjin_tired");
                            }
                        },
                        sub: true,
                        sourceSkill: "ganjin_old",
                        "_priority": 0,
                    },
                    tired: {
                        trigger: {
                            player: "phaseEnd",
                        },
                        Yx: true,
                        popup: false,
                        filter: function (event, player) {
                            return player.hasSkill("ganjin_tired");
                        },
                        charlotte: true,
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/attacked.png >",
                        intro: {
                            content: "没有干劲了。。。",
                        },
                        forced: true,
                        content: function(){
                                player.removeSkill("ganjin_tired");
                        },
                        sub: true,
                        sourceSkill: "ganjin_old",
                        "_priority": 0,
                    },
                    zhuSkill: {
                        trigger: {
                            global: "gameDrawBefore",
                        },
                        Yx: true,
                        direct: true,
                        filter: function (event, player) {
                            return player.identity == 'zhu'&& game.players.length >= 4;
                        },
                        content: function () {
                            "step 0"
                            var list=["boss_tongchou","boss_xieli","boss_xisheng","boss_yingyuan"];
                            player.chooseControl(list).set("prompt","选择并获得一项BOSS技：").set("ai",function(){
                                return list.randomGet();
                            });
                            "step 1"
                            if(result.control == "boss_tongchou"){
                                player.addSkill("boss_tongchou");
                                game.log(player,"获得了BOSS技【","boss_tongchou","】")
                            }
                            else if(result.control == "boss_xieli"){
                                player.addSkill("boss_xieli");
                                game.log(player,"获得了BOSS技【","boss_xieli","】")
                            }
                            else if (result.control == "boss_xisheng"){
                                player.addSkill("boss_xisheng");
                                game.log(player,"获得了BOSS技【","boss_xisheng","】")
                            }
                            else {
                                player.addSkill("boss_yingyuan");
                                game.log(player,"获得了BOSS技【","boss_yingyuan","】")
                            }
                            "step 2"
                            //早苗防冲突
                            //if(player.name=="sanae"){
                           //     player.removeSkill("ganjin_yanhui");
                           // }
                        },
                        sub: true,
                        sourceSkill: "ganjin_old",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "chen_shikigami1": {
                mark: true,
                onremove: true,
                marktext: "式神",
                intro: {
                    content: "你建立了式神链接",
                },
                mod: {
                    inRange: function (from, to) {
                        if (!from.hasSkill("chen_shikigami1") || from._chen_shikigami1) return;
                        from._chen_shikigami1 = true;
                        var bool = game.hasPlayer(function (current) {
                            return current != from && current != to && current.hasSkill("chen_shikigami2") && from.hasSkill("chen_shikigami1", current) && current.inRange(to);
                        });
                        delete from._chen_shikigami1;
                        if (bool) return true;
                    },
                },
                direct: true,
                trigger: {
                    player: "phaseBefore",
                },
                content: function(){
                    "step 0"
                    player.removeSkill('chen_shikigami1');
                    "step 1"
                    for (var i = 0; i < game.players.length; i++) {
                        game.players[i].removeSkill('chen_shikigami2');
                    };
                },
                "_priority": 0,
            },
            "chen_shikigami2": {
                mark: true,
                onremove: true,
                marktext: "式神",
                intro: {
                    content: "你成为了式神链接的对象",
                },
                mod: {
                    inRange: function (from, to) {
                        if (!from.hasSkill("chen_shikigami2") || from._chen_shikigami2) return;
                        from._chen_shikigami2 = true;
                        var bool = game.hasPlayer(function (current) {
                            return current != from && current != to && current.hasSkill("chen_shikigami1") && from.hasSkill("chen_shikigami2", current) && current.inRange(to);
                        });
                        delete from._chen_shikigami2;
                        if (bool) return true;
                    },
                },
                "_priority": 0,
            },
            "remilia_stg": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "useCardToTargeted",
                },
                logTarget: "target",
                locked: false,
                check: function(event, player) {
                    return get.attitude(player, event.target) <= 0;
                },
                filter: function(event, player) {
                    if (event.card.name != "sha") return false;
                    if (event.target.countCards("h") < player.countCards("h")) return true;
                    if (event.target.hp > player.hp) return true;
                    return false;
                },
                content: async function(event, trigger, player) {
                    if (trigger.target.hp > player.hp) trigger.getParent().directHit.push(trigger.target);
                    if (trigger.target.countCards("h") < player.countCards("h")) trigger.getParent().directHit.push(trigger.target);
                },
                ai: {
                    threaten: 0.5,
                    "directHit_ai": true,
                    skillTagFilter: function(player, tag, arg) {
                        if (
                            get.attitude(player, arg.target) <= 0 &&
                            arg.card.name == "sha" &&
                            player.countCards("h", function (card) {
                                return card != arg.card && (!arg.card.cards || !arg.card.cards.includes(card));
                            }) >= arg.target.countCards("h")
                        )
                            return true;
                        return false;
                    },
                },
                "_priority": 0,
            },
            "remilia_vampirekiss": {
                audio: "ext:车万符斗祭:1",
                mod: {
                    targetInRange: function(card,player,target,now){
                    if(card.name=='sha'&&get.color(card)=='red') return true;
                    },
                },
                trigger: {
                    source: "damageEnd",
                },
                filter: function(event,player){
                return event.card&&((event.card.name=='houraitrick'||event.card.name=='sha')&&get.color(event.card)=='red')&&event.notLink();
                },
                forced: true,
                content: function(){
                    if(player.hasSkill("remilia_scarletmist2")){}
                    else player.recover(1);
                },
                ai: {
                    effect: {
                        player: function(card,player,target){
                        if(card.name=='sha'&&get.color(card)=='red'){
                        if(get.attitude(player,target)>0)return [1,-0.5];
                        return [1,0.8];
                        }
                        },
                    },
                },
                "_priority": 0,
            },
            "remilia_scarletmist": {
                audio: "ext:车万符斗祭:2",
                unique: true,
                zhuSkill: true,
                enable: "phaseUse",
                filter: function (event,player){
                    var num=game.countPlayer(function(current){
                        return current.identity=='zhong';
                    });
                    return game.hasPlayer(function(current){
                        return current!=player&&current.isFriendOf(player);
                    })||num>=1;
                },
                filterTarget: function (card,player,target){
                    var num=game.countPlayer(function(current){
                        return current.identity=='zhong';
                    });
                    //if(target==player) return false;       //if(ui.selected.targets.length&&ui.selected.targets[0]!=target&&!ui.selected.targets[0].isFriendOf(target)){
                        //return false;
                    //}
                    return true;
                },
                selectTarget: function (){
                    var num=game.countPlayer(function(current){
                        return current.identity=='zhong';
                    });
                    if(num>=1) return [1,num];
                    return [1,1];
                },
                multitarget: true,
                multiline: true,
                content: function (){
                    "step 0"
                    game.log("红雾升起了...");
                    player.awakenSkill('remilia_scarletmist');
                    "step 1"
                    player.addSkill('remilia_scarletmist2');
                    player.addSkill('remilia_scarletmist_removeAll');
                    for(var i=0;i<targets.length;i++){
                        targets[i].addSkill('remilia_scarletmist2');
                        //targets[i].addSkill('remilia_scarletmist_forced');
                    }
                    "step 2"
                    var others = game.filterPlayer();
                    others.remove(player);
                    for (var i = 0; i < others.length; i++) {
                        if (targets.includes(others[i]) == false) {
                           others[i].addSkill('remilia_scarletmist_forced');
                        }
                    }
                },
                ai: {
                    order: 8.5,
                    result: {
                        target: function (player,target){
                        var num=game.countPlayer(function(current){
                            return get.attitude(player,current)>0;
                        });
                        if(target==player) return -num;
                        if(ui.selected.targets.length) return -1;
                        return 1;},
                    },
                },
                subSkill: {
                    forced: {
                        priority: Infinity,
                        onremove: true,
                        mod: {
                            attackRange: () => 1,
                        },
                        "_priority": Infinity,
                        sub: true,
                        sourceSkill: "remilia_scarletmist",
                    },
                    removeAll: {
                        Yx: true,
                        trigger: {
                            player: "phaseBefore",
                        },
                        content: function(){
                            game.countPlayer(function (current) {
                                if (current.hasSkill('remilia_scarletmist2')) {
                                    current.removeSkill('remilia_scarletmist2');
                                }
                                if (current.hasSkill('remilia_scarletmist_forced')){
                                    current.removeSkill('remilia_scarletmist_forced');
                                }
                                game.log('红雾结束了...');
                            });
                        },
                        sub: true,
                        sourceSkill: "remilia_scarletmist",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "zhu1": {
                unique: true,
                zhuSkill: true,
                trigger: {
                    global: "gameStart",
                    player: "enterGame",
                },
                Yx: true,
                direct: true,
                filter: function (event, player) {
                    return player.identity == 'zhu';
                },
                content: function () {
                    player.removeSkill("ganjin_zhuSkill");
                },
                "_priority": 0,
            },
            "remilia_scarletmist2": {
                mark: true,
                onremove: true,
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/scarlet_mist.png >",
                intro: {
                    content: "你使用弹幕时无视距离，且使用弹幕造成伤害后回复等量的体力。其他角色使用弹幕时只能指定距离为1的目标。",
                },
                mod: {
                    targetInRange: function (card, player) {
                        return card.name == 'sha';
                    },
                },
                trigger: {
                    source: "damageSource",
                },
                filter: function(event,player){
                return event.card&&(event.card.name=='houraitrick'||event.card.name=='sha');
                },
                direct: true,
                logTarget: "player",
                content: function(){
                    "step 0"
                    player.recover(trigger.num);
                    //game.delay(3.0);
                    //game.delay(0.1);
                    //"step 1"
                    //if([player.name, player.name1, player.name2].includes("remilia") &&! player.isHealthy){
                    //    game.playAudio("../extension/车万符斗祭/",'remilia_vampirekiss1');
                    //}
                },
                "_priority": 0,
            },
            "meirin_loongpunch": {
                audio: "ext:车万符斗祭:1",
                group: ["meirin_loongpunch_sha","meirin_loongpunch_shan"],
                subSkill: {
                    sha: {
                        audio: "meirin_loongpunch",
                        trigger: {
                            player: "shaMiss",
                        },
                        filter: function(event) {
                            return event.target.countCards("h") > 0;
                        },
                        check: function(event, player) {
                            return get.attitude(player, event.target) < 0;
                        },
                        logTarget: "target",
                        content: async function(event, trigger, player) {
                            await player.discardPlayerCard("h", trigger.target, true);
                        },
                        sub: true,
                        sourceSkill: "meirin_loongpunch",
                        "_priority": 0,
                    },
                    shan: {
                        trigger: {
                            player: ["useCard","respond"],
                        },
                        filter: function (event,player){
                            if(event.card.name!='shan') return false;
                            if(event.getParent(2).name!='sha') return false;
                            return true;
                        },
                        check: function (event,player){
                            return get.attitude(player,event.getParent(2).player)<=0;
                            //var cards=event.getParent(2).targets;
                            //for(var i=0;i<cards.length;i++){
                            //    if(get.attitude(player,cards[i])>0) return false;
                            //}
                            //return true;
                        },
                        content: function (){
                            player.discardPlayerCard('h',true,trigger.getParent(2).player);
                            //trigger.getParent(2).player.chooseToDiscard(true);
                            //每当你使用一张“闪”响应“杀”时，你可以弃置此“杀”的使用者一张手牌。
                        },
                        audio: "meirin_loongpunch",
                        sub: true,
                        sourceSkill: "meirin_loongpunch",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "meirin_rb": {
                audio: "ext:车万符斗祭:1",
                derivation: ["meirin_taichi","meirin_taichi_sha","meirin_taichi_shan"],
                unique: true,
                juexingji: true,
                trigger: {
                    player: "phaseBefore",
                },
                forced: true,
                locked: false,
                filter: function(event,player){
                if(game.hasPlayer(function(current){
                return current.hp<player.hp;
                })) return false;
                if(player.hp==player.maxHp) return false;
                return player.hp<=2;
                },
                content: function(){
                    player.awakenSkill("meirin_rb");
                    player.maxHp--;
                    player.addSkill("meirin_taichi");
                    player.update();
                },
                "_priority": 0,
            },
            "meirin_taichi": {
                audio: "ext:车万符斗祭:1",
                group: ["meirin_taichi_sha","meirin_taichi_shan"],
                subSkill: {
                    sha: {
                        audio: "meirin_taichi",
                        enable: ["chooseToUse","chooseToRespond"],
                        filterCard: {
                            name: "shan",
                        },
                        viewAs: {
                            name: "sha",
                        },
                        viewAsFilter: function(player) {
                            if (!player.countCards("hs", "shan")) return false;
                        },
                        position: "hs",
                        prompt: "将一张闪当杀使用或打出",
                        check: function() {
                            return 1;
                        },
                        ai: {
                            effect: {
                                target: function(card, player, target, current) {
                                    if (get.tag(card, "respondSha") && current < 0) return 0.6;
                                },
                            },
                            respondSha: true,
                            skillTagFilter: function(player) {
                                if (!player.countCards("hs", "shan")) return false;
                            },
                            order: function() {
                                return get.order({ name: "sha" }) + 0.1;
                            },
                            useful: -1,
                            value: -1,
                            yingbian: function (card, player, targets, viewer) {
                                if (get.attitude(viewer, player) <= 0) return 0;
                                var base = 0,
                                    hit = false;
                                if (get.cardtag(card, "yingbian_hit")) {
                                    hit = true;
                                    if (
                                        targets.some(target => {
                                            return (
                                                target.mayHaveShan(
                                                    viewer,
                                                    "use",
                                                    target.getCards("h", i => {
                                                        return i.hasGaintag("sha_notshan");
                                                    })
                                                ) &&
                                                get.attitude(viewer, target) < 0 &&
                                                get.damageEffect(target, player, viewer, get.natureList(card)) > 0
                                            );
                                        })
                                    )
                                        base += 5;
                                }
                                if (get.cardtag(card, "yingbian_add")) {
                                    if (
                                        game.hasPlayer(function (current) {
                                            return !targets.includes(current) && lib.filter.targetEnabled2(card, player, current) && get.effect(current, card, player, player) > 0;
                                        })
                                    )
                                        base += 5;
                                }
                                if (get.cardtag(card, "yingbian_damage")) {
                                    if (
                                        targets.some(target => {
                                            return (
                                                get.attitude(player, target) < 0 &&
                                                (hit ||
                                                    !target.mayHaveShan(
                                                        viewer,
                                                        "use",
                                                        target.getCards("h", i => {
                                                            return i.hasGaintag("sha_notshan");
                                                        })
                                                    ) ||
                                                    player.hasSkillTag(
                                                        "directHit_ai",
                                                        true,
                                                        {
                                                            target: target,
                                                            card: card,
                                                        },
                                                        true
                                                    )) &&
                                                !target.hasSkillTag("filterDamage", null, {
                                                    player: player,
                                                    card: card,
                                                    jiu: true,
                                                })
                                            );
                                        })
                                    )
                                        base += 5;
                                }
                                return base;
                            },
                            canLink: function(player, target, card) {
                                if (!target.isLinked() && !player.hasSkill("wutiesuolian_skill")) return false;
                                if (player.hasSkill("jueqing") || player.hasSkill("gangzhi") || target.hasSkill("gangzhi")) return false;
                                let obj = {};
                                if (get.attitude(player, target) > 0 && get.attitude(target, player) > 0) {
                                    if (
                                        (player.hasSkill("jiu") ||
                                            player.hasSkillTag("damageBonus", true, {
                                                target: target,
                                                card: card,
                                            })) &&
                                        !target.hasSkillTag("filterDamage", null, {
                                            player: player,
                                            card: card,
                                            jiu: player.hasSkill("jiu"),
                                        })
                                    )
                                        obj.num = 2;
                                    if (target.hp > obj.num) obj.odds = 1;
                                }
                                if (!obj.odds)
                                    obj.odds =
                                        1 -
                                        target.mayHaveShan(
                                            player,
                                            "use",
                                            target.getCards("h", i => {
                                                return i.hasGaintag("sha_notshan");
                                            }),
                                            "odds"
                                        );
                                return obj;
                            },
                            basic: {
                                useful: [5,3,1],
                                value: [5,3,1],
                            },
                            result: {
                                target: function (player, target, card, isLink) {
                                    let eff = -1.5,
                                        odds = 1.35,
                                        num = 1;
                                    if (isLink) {
                                        eff = isLink.eff || -2;
                                        odds = isLink.odds || 0.65;
                                        num = isLink.num || 1;
                                        if (
                                            num > 1 &&
                                            target.hasSkillTag("filterDamage", null, {
                                                player: player,
                                                card: card,
                                                jiu: player.hasSkill("jiu"),
                                            })
                                        )
                                            num = 1;
                                        return odds * eff * num;
                                    }
                                    if (
                                        player.hasSkill("jiu") ||
                                        player.hasSkillTag("damageBonus", true, {
                                            target: target,
                                            card: card,
                                        })
                                    ) {
                                        if (
                                            target.hasSkillTag("filterDamage", null, {
                                                player: player,
                                                card: card,
                                                jiu: player.hasSkill("jiu"),
                                            })
                                        )
                                            eff = -0.5;
                                        else {
                                            num = 2;
                                            if (get.attitude(player, target) > 0) eff = -7;
                                            else eff = -4;
                                        }
                                    }
                                    if (
                                        !player.hasSkillTag(
                                            "directHit_ai",
                                            true,
                                            {
                                                target: target,
                                                card: card,
                                            },
                                            true
                                        )
                                    )
                                        odds -=
                                            0.7 *
                                            target.mayHaveShan(
                                                player,
                                                "use",
                                                target.getCards("h", i => {
                                                    return i.hasGaintag("sha_notshan");
                                                }),
                                                "odds"
                                            );
                                    _status.event.putTempCache("sha_result", "eff", {
                                        bool: target.hp > num && get.attitude(player, target) > 0,
                                        card: ai.getCacheKey(card, true),
                                        eff: eff,
                                        odds: odds,
                                    });
                                    return odds * eff;
                                },
                            },
                            tag: {
                                respond: 1,
                                respondShan: 1,
                                damage: function (card) {
                                    if (game.hasNature(card, "poison")) return;
                                    return 1;
                                },
                                natureDamage: function (card) {
                                    if (game.hasNature(card, "linked")) return 1;
                                },
                                fireDamage: function (card, nature) {
                                    if (game.hasNature(card, "fire")) return 1;
                                },
                                thunderDamage: function (card, nature) {
                                    if (game.hasNature(card, "thunder")) return 1;
                                },
                                poisonDamage: function (card, nature) {
                                    if (game.hasNature(card, "poison")) return 1;
                                },
                                "jy_xieDamage": function(card,naturex){
                                    if(game.hasNature(card,'jy_xie')) return 1;
                                },
                                "jy_duDamage": function(card,naturex){
                                    if(game.hasNature(card,'jy_du')) return 1;
                                },
                            },
                        },
                        sub: true,
                        sourceSkill: "meirin_taichi",
                        "_priority": 0,
                    },
                    shan: {
                        audio: "meirin_taichi",
                        enable: ["chooseToRespond","chooseToUse"],
                        filterCard: {
                            name: "sha",
                        },
                        viewAs: {
                            name: "shan",
                        },
                        prompt: "将一张杀当闪使用或打出",
                        check: function() {
                            return 1;
                        },
                        position: "hs",
                        viewAsFilter: function(player) {
                            if (!player.countCards("hs", "sha")) return false;
                        },
                        ai: {
                            respondShan: true,
                            skillTagFilter: function(player) {
                                if (!player.countCards("hs", "sha")) return false;
                            },
                            effect: {
                                target: function(card, player, target, current) {
                                    if (get.tag(card, "respondShan") && current < 0) return 0.6;
                                },
                            },
                            order: 4,
                            useful: -1,
                            value: -1,
                            basic: {
                                useful: (card, i) => {
                                    let player = _status.event.player,
                                        basic = [7, 5.1, 2],
                                        num = basic[Math.min(2, i)];
                                    if (player.hp > 2 && player.hasSkillTag("maixie")) num *= 0.57;
                                    if (player.hasSkillTag("freeShan", false, null, true) || player.getEquip("rewrite_renwang")) num *= 0.8;
                                    return num;
                                },
                                value: [7,5.1,2],
                            },
                            result: {
                                player: 1,
                            },
                        },
                        sub: true,
                        sourceSkill: "meirin_taichi",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "meirin_miss": {
                group: ["meirin_miss_unawaken","meirin_miss_awaken"],
                subSkill: {
                    unawaken: {
                        superCharlotte: true,
                        direct: true,
                        trigger: {
                            player: "dieBefore",
                        },
                        filter: function(event, player){
                            return !player.hasSkill("meirin_taichi");
                        },
                        content: function(){
                            game.playAudio("../extension/车万符斗祭/audio/die/",'meirin_miss2');
                        },
                        sub: true,
                        sourceSkill: "meirin_miss",
                        "_priority": 0,
                    },
                    awaken: {
                        superCharlotte: true,
                        direct: true,
                        trigger: {
                            player: "dieBefore",
                        },
                        filter: function(event, player){
                            return player.hasSkill("meirin_taichi");
                        },
                        content: function(){
                            game.playAudio("../extension/车万符斗祭/audio/die/",'meirin_miss1');
                        },
                        sub: true,
                        sourceSkill: "meirin_miss",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            oldlongquan: {
                trigger: {
                    target: "shaMiss",
                },
                check: function (event,player){
                    return get.attitude(player,event.player)<=0;
                },
                filter: function (event,player){
                    return event.player.countCards('h')>0;
                },
                logTarget: "player",
                content: async function(event, trigger, target) {
                    await target.discardPlayerCard("h", trigger.player, true);
                },
                "_priority": 0,
            },
            "sakuya_dagger": {
                audio: "ext:车万符斗祭:2",
                enable: ["chooseToUse","chooseToRespond"],
                filterCard: {
                    type: "equip",
                },
                viewAs: {
                    name: "sha",
                },
                viewAsFilter: function (player) {
                    return player.countCards('he', { type: 'equip' }) != 0;
                  },
                position: "he",
                prompt: "你可以将一张装备牌当弹幕使用或打出，以此法使用的弹幕无距离限制。",
                check: function (card) {
                    if (get.subtype(card) == 'equip1') return 10 - get.value(card);
                    return 7 - get.equipValue(card);
                  },
                mod: {
                    targetInRange: function (card) {
                      if (_status.event.skill == 'sakuya_dagger') return true;
                    },
                },
                ai: {
                    order: function () {
                      return lib.card.sha.ai.order + 0.1;
                    },
                    respondSha: true,
                    skillTagFilter: function (player) {
                      if (!player.countCards('he')) return false;
                    },
                    yingbian: function (card, player, targets, viewer) {
                        if (get.attitude(viewer, player) <= 0) return 0;
                        var base = 0,
                            hit = false;
                        if (get.cardtag(card, "yingbian_hit")) {
                            hit = true;
                            if (
                                targets.some(target => {
                                    return (
                                        target.mayHaveShan(
                                            viewer,
                                            "use",
                                            target.getCards("h", i => {
                                                return i.hasGaintag("sha_notshan");
                                            })
                                        ) &&
                                        get.attitude(viewer, target) < 0 &&
                                        get.damageEffect(target, player, viewer, get.natureList(card)) > 0
                                    );
                                })
                            )
                                base += 5;
                        }
                        if (get.cardtag(card, "yingbian_add")) {
                            if (
                                game.hasPlayer(function (current) {
                                    return !targets.includes(current) && lib.filter.targetEnabled2(card, player, current) && get.effect(current, card, player, player) > 0;
                                })
                            )
                                base += 5;
                        }
                        if (get.cardtag(card, "yingbian_damage")) {
                            if (
                                targets.some(target => {
                                    return (
                                        get.attitude(player, target) < 0 &&
                                        (hit ||
                                            !target.mayHaveShan(
                                                viewer,
                                                "use",
                                                target.getCards("h", i => {
                                                    return i.hasGaintag("sha_notshan");
                                                })
                                            ) ||
                                            player.hasSkillTag(
                                                "directHit_ai",
                                                true,
                                                {
                                                    target: target,
                                                    card: card,
                                                },
                                                true
                                            )) &&
                                        !target.hasSkillTag("filterDamage", null, {
                                            player: player,
                                            card: card,
                                            jiu: true,
                                        })
                                    );
                                })
                            )
                                base += 5;
                        }
                        return base;
                    },
                    canLink: function(player, target, card) {
                        if (!target.isLinked() && !player.hasSkill("wutiesuolian_skill")) return false;
                        if (player.hasSkill("jueqing") || player.hasSkill("gangzhi") || target.hasSkill("gangzhi")) return false;
                        let obj = {};
                        if (get.attitude(player, target) > 0 && get.attitude(target, player) > 0) {
                            if (
                                (player.hasSkill("jiu") ||
                                    player.hasSkillTag("damageBonus", true, {
                                        target: target,
                                        card: card,
                                    })) &&
                                !target.hasSkillTag("filterDamage", null, {
                                    player: player,
                                    card: card,
                                    jiu: player.hasSkill("jiu"),
                                })
                            )
                                obj.num = 2;
                            if (target.hp > obj.num) obj.odds = 1;
                        }
                        if (!obj.odds)
                            obj.odds =
                                1 -
                                target.mayHaveShan(
                                    player,
                                    "use",
                                    target.getCards("h", i => {
                                        return i.hasGaintag("sha_notshan");
                                    }),
                                    "odds"
                                );
                        return obj;
                    },
                    basic: {
                        useful: [5,3,1],
                        value: [5,3,1],
                    },
                    result: {
                        target: function (player, target, card, isLink) {
                            let eff = -1.5,
                                odds = 1.35,
                                num = 1;
                            if (isLink) {
                                eff = isLink.eff || -2;
                                odds = isLink.odds || 0.65;
                                num = isLink.num || 1;
                                if (
                                    num > 1 &&
                                    target.hasSkillTag("filterDamage", null, {
                                        player: player,
                                        card: card,
                                        jiu: player.hasSkill("jiu"),
                                    })
                                )
                                    num = 1;
                                return odds * eff * num;
                            }
                            if (
                                player.hasSkill("jiu") ||
                                player.hasSkillTag("damageBonus", true, {
                                    target: target,
                                    card: card,
                                })
                            ) {
                                if (
                                    target.hasSkillTag("filterDamage", null, {
                                        player: player,
                                        card: card,
                                        jiu: player.hasSkill("jiu"),
                                    })
                                )
                                    eff = -0.5;
                                else {
                                    num = 2;
                                    if (get.attitude(player, target) > 0) eff = -7;
                                    else eff = -4;
                                }
                            }
                            if (
                                !player.hasSkillTag(
                                    "directHit_ai",
                                    true,
                                    {
                                        target: target,
                                        card: card,
                                    },
                                    true
                                )
                            )
                                odds -=
                                    0.7 *
                                    target.mayHaveShan(
                                        player,
                                        "use",
                                        target.getCards("h", i => {
                                            return i.hasGaintag("sha_notshan");
                                        }),
                                        "odds"
                                    );
                            _status.event.putTempCache("sha_result", "eff", {
                                bool: target.hp > num && get.attitude(player, target) > 0,
                                card: ai.getCacheKey(card, true),
                                eff: eff,
                                odds: odds,
                            });
                            return odds * eff;
                        },
                    },
                    tag: {
                        respond: 1,
                        respondShan: 1,
                        damage: function (card) {
                            if (game.hasNature(card, "poison")) return;
                            return 1;
                        },
                        natureDamage: function (card) {
                            if (game.hasNature(card, "linked")) return 1;
                        },
                        fireDamage: function (card, nature) {
                            if (game.hasNature(card, "fire")) return 1;
                        },
                        thunderDamage: function (card, nature) {
                            if (game.hasNature(card, "thunder")) return 1;
                        },
                        poisonDamage: function (card, nature) {
                            if (game.hasNature(card, "poison")) return 1;
                        },
                        "jy_xieDamage": function(card,naturex){
                            if(game.hasNature(card,'jy_xie')) return 1;
                        },
                        "jy_duDamage": function(card,naturex){
                            if(game.hasNature(card,'jy_du')) return 1;
                        },
                    },
                },
                "_priority": 0,
            },
            "sakuya_lunadial": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseBegin",
                },
                forced: true,
                content: function () {
                    trigger.phaseList.splice(trigger.num, 0, "phaseUse|sakuya_lunadial");
                    lib.skill.ganjin.change(player, 1);
                    game.log(player,'获得了一点干劲。');
                },
                "_priority": 0,
            },
            "suika_heavydrinker": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                filter: function (event, player) {
                    if(player.hasSkill('suika_heavydrinker_silent')) return false;
                    return (
                        player.countCards("h") > 0 &&
                        (!player.storage.suika_heavydrinker_targeted ||
                            game.hasPlayer(function (current) {
                                return !player.storage.suika_heavydrinker_targeted.includes(current);
                            }))
                    );
                },
                filterTarget: function (card, player, target) {
                    return player.canCompare(target);
                },
                content: function () {
                    "step 0"
                    player.chooseToCompare(target);
                    'step 1'
                    if(result.bool) {
                        player.addSkill("hezui");
                        target.addSkill("hezui");
                        player.addTempSkill("suika_heavydrinker_targeted", "phaseUseEnd");
                        player.markAuto("suika_heavydrinker_targeted", targets);
                        //player.useCard({name:'card_wine',isCard:true,audio:false},player);
                    }
                    else player.addTempSkill('suika_heavydrinker_silent');
                },
                ai: {
                    order: function(name, player) {
                        const cards = player.getCards("h");
                        if (player.countCards("h", "sha") == 0) {
                            return 1;
                        }
                        for (let i = 0; i < cards.length; i++) {
                            if (cards[i].name != "sha" && get.number(cards[i]) > 11 && get.value(cards[i]) < 7) {
                                return 9;
                            }
                        }
                        return get.order({ name: "sha" }) - 1;
                    },
                    result: {
                        player: function(player) {
                            if (player.countCards("h", "sha") > 0) return 0.6;
                            const num = player.countCards("h");
                            if (num > player.hp) return 0;
                            if (num == 1) return -2;
                            if (num == 2) return -1;
                            return -0.7;
                        },
                        target: function(player, target) {
                            const num = target.countCards("h");
                            if (num == 1) return -1;
                            if (num == 2) return -0.7;
                            return -0.5;
                        },
                    },
                    threaten: 1.3,
                },
                subSkill: {
                    targeted: {
                        onremove: true,
                        sub: true,
                        sourceSkill: "suika_heavydrinker",
                        "_priority": 0,
                    },
                    silent: {
                        onremove: true,
                        sub: true,
                        sourceSkill: "suika_heavydrinker",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "suika_drunkendream": {
                audio: "ext:车万符斗祭:1",
                mod: {
                    attackRange: function (player, num) {
                        if(player.hasSkill("hezui")) return num + 2;
                    },
                },
                group: ["suika_drunkendream_draw"],
                subSkill: {
                    draw: {
                        audio: "suika_drunkendream",
                        trigger: {
                            player: "phaseBefore",
                        },
                        filter: function(event,player){
                            return player.hasSkill("hezui");
                        },
                        forced: true,
                        content: function(){
                            player.draw(1);
                        },
                        sub: true,
                        sourceSkill: "suika_drunkendream",
                        "_priority": 6,
                    },
                },
                "_priority": 0,
            },
            "marisa_borrow": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                filterTarget: function (card, player, target) {
                    return player != target && target.countCards('he') > 0;
                },
                content: function () {
                    'step 0'
                    player.gainPlayerCard(target, 'he', true);
                    'step 1'
                    if (result.bool && target.canUse({ name: "sha", isCard: true }, player, false) && get.effect(player, { name: "sha", isCard: true }, target, target) > 0) {
                        target.chooseBool("是否对" + get.translation(player) + "使用一张杀？").ai = function () {
                            return get.attitude(target, player) < 0;
                        };
                    } else event.finish();
                    "step 2"
                    if (result.bool) {
                        target.useCard({ name: "sha", isCard: true }, player, "noai");
                    }
                },
                ai: {
                    order: 8,
                    result: {
                        target: -1,
                        player: function (player, target) {
                            if (get.damageEffect(target, player, player) > 0 && target.hasSha()) {
                                return -2;
                            }
                            if (target.countCards("h") == 0) {
                                return 0;
                            }
                            return -0.5;
                        },
                    },
                },
                "_priority": 0,
            },
            "aya_ultimatespeed": {
                audio: "ext:车万符斗祭:1",
                intro: false,
                trigger: {
                    player: ["useCard","respond"],
                },
                forced: true,
                popup: false,
                filter: function (event, player) {
                    if (get.subtype(event.card, false) == "equip1") return false;
                    if (player.hasSkill("aya_ultimatespeed_inrange")) return false;
                    if (!player.isPhaseUsing()) return false;
                    return true;
                },
                content: function () {
                    "step 0"
                    var num = player.countMark("aya_ultimatespeed");
                    if (num < 1) {
                        player.addMark("aya_ultimatespeed",1);
                    } else {
                        player.logSkill("aya_ultimatespeed");
                        player.draw();
                        player.addTempSkill("aya_ultimatespeed_inrange", 'phaseEnd');
                        player.removeMark("aya_ultimatespeed",true);
                    }
                },
                ai: {
                    effect: {
                        "player_use": function(card, player) {
                            if (_status.currentPhase != player) return;
                            if (get.type(card) == "basic") return;
                            if (get.tag(card, "gain")) return;
                            if (get.value(card, player, "raw") >= 7) return;
                            if (player.hp <= 2) return;
                            if (player.needsToDiscard()) return;
                            if (player.countUsed() >= 2) return;
                            return "zeroplayertarget";
                        },
                    },
                },
                group: ["aya_ultimatespeed_weapon","aya_ultimatespeed_clear"],
                subSkill: {
                    weapon: {
                        audio: "aya_ultimatespeed",
                        trigger: {
                            player: "useCardAfter",
                        },
                        forced: true,
                        popup: false,
                        filter: function (event, player) {
                            if (!player.isPhaseUsing()) return false;
                            return get.subtype(event.card, false) == "equip1";
                        },
                        content: function () {
                            //为武器装备单独设置
                            "step 0"
                            var num = player.countMark("aya_ultimatespeed");
                            if (num < 1) {
                                player.addMark("aya_ultimatespeed",1);
                            } else {
                                player.logSkill("aya_ultimatespeed");
                                player.draw();
                                player.addTempSkill("aya_ultimatespeed_inrange", 'phaseEnd');
                                player.removeMark("aya_ultimatespeed",player.countMark("aya_ultimatespeed"));
                            }
                        },
                        sub: true,
                        sourceSkill: "aya_ultimatespeed",
                        "_priority": 0,
                    },
                    inrange: {
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/aya_range_max.png >",
                        intro: {
                            content: "本回合内你使用牌无距离限制。",
                        },
                        mod: {
                            targetInRange: function(card,player,target){
                            return true;
                            },
                        },
                        sub: true,
                        sourceSkill: "aya_ultimatespeed",
                        "_priority": 0,
                    },
                    clear: {
                        trigger: {
                            player: "phaseEnd",
                        },
                        supercharlotte: true,
                        firstDo: true,
                        forced: true,
                        content: function () {
                            player.removeMark("aya_ultimatespeed", player.countMark("aya_ultimatespeed"));
                        },
                        sub: true,
                        sourceSkill: "aya_ultimatespeed",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "reisen_lunatic": {
                audio: "ext:车万符斗祭:2",
                trigger: {
                    source: "damageEnd",
                },
                filter: function(event,player){
                return event.card&&(event.card.name=='sha'||event.card.name=='juedou');
                },
                content: function(){
                'step 0'
                trigger.player.addSkill("sangxin");
                },
                ai: {
                    expose: 0.25,
                },
                subSkill: {
                    sangxin: {
                        sub: true,
                        sourceSkill: "reisen_lunatic",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "reisen_mahjongdrug": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "useCardAfter",
                },
                filter: function (event, player) {
                    return event.card.name == "tao"; //&& player == event.player && event.player.isIn();
                },
                content: function () {
                    player.addSkill("hezui");
                },
                "_priority": 0,
            },
            "aya_ultimatespeed_old": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "useCardAfter",
                },
                forced: true,
                filter: function (event, player) {
                    return event.getParent().name!='recast' && _status.currentPhase == player && [2].includes(player.countUsed());
                },
                content: function () {
                    "step 0"
                    player.draw();
                    "step 1"
                    var skill;
                    switch (player.countUsed()) {
                        case 2:
                            skill = "aya_ultimatespeed_inrange";
                            break;
                    }
                    if (skill && !player.hasSkill(skill)) {
                        player.addTempSkill(skill, 'phaseEnd');
                        game.log(player, "飞起来了");
                    }
                },
                ai: {
                    effect: {
                        "player_use": function(card, player) {
                            if (_status.currentPhase != player) return;
                            if (get.type(card) == "basic") return;
                            if (get.tag(card, "gain")) return;
                            if (get.value(card, player, "raw") >= 7) return;
                            if (player.hp <= 2) return;
                            if (player.needsToDiscard()) return;
                            if (player.countUsed() >= 2) return;
                            return "zeroplayertarget";
                        },
                    },
                },
                subSkill: {
                    inrange: {
                        mod: {
                            targetInRange: function(card,player,target){
                            return true;
                            },
                        },
                        sub: true,
                        sourceSkill: "aya_ultimatespeed_old",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            sangxin: {
                mark: true,
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/reisen_discarder.png >",
                intro: {
                    content: "锁定技，出牌阶段，你不能使用弹幕以外的牌；你使用弹幕只能指定距离最近的目标；结束阶段开始时，你失去此技能。",
                },
                mod: {
                    cardEnabled: function (card) {
                        if (card.name == "sha") return;
                        return false;
                    },
                },
                trigger: {
                    player: "phaseEnd",
                },
                supercharlotte: true,
                forced: true,
                popup: false,
                content: function () {
                    player.removeSkill("sangxin");
                },
                "_priority": 0,
            },
            "sp_aya_fengmi": {
                mark: true,
                marktext: "※",
                intro: {
                    content: "已记录花色：$",
                    onunmark: true,
                },
                trigger: {
                    player: "useCard",
                },
                direct: true,
                popup: true,
                firstDo: true,
                init: function (player) {
                    player.storage.sp_aya_fengmi = [];
                },
                filter: function (event, player) {
                    if (!player.isPhaseUsing()) return false;
                    var suit = get.suit(event.card);
                    return lib.suit.includes(suit) && !player.storage.sp_aya_fengmi.includes(suit);
                },
                content: function () {
                    player.storage.sp_aya_fengmi.push(get.suit(trigger.card));
                    player.syncStorage('sp_aya_fengmi');
                    player.markSkill('sp_aya_fengmi'); 
                },
                group: ["sp_aya_fengmi_phase","sp_aya_fengmi_clear"],
                subSkill: {
                    phase: {
                        trigger: {
                            player: "phaseEnd",
                        },
                        filter: function (event, player) {
                            return player.storage.sp_aya_fengmi.length >= 4;
                        },
                        check: function (event, player) { return true;},
                        content: function () {
                            "step 0"
                            player.insertPhase();
                            player.syncStorage('sp_aya_fengmi');
                            player.storage.sp_aya_fengmi.length = 0;
                            player.update();
                            //player.unmarkSkill("sp_aya_fengmi");
                        },
                        sub: true,
                        "_priority": 5,
                        sourceSkill: "sp_aya_fengmi",
                    },
                    clear: {
                        trigger: {
                            player: "phaseEnd",
                        },
                        filter: function (event, player) {
                            return player.storage.sp_aya_fengmi.length < 4;
                        },
                        supercharlotte: true,
                        firstDo: true,
                        forced: true,
                        content: function () {
                            player.syncStorage('sp_aya_fengmi');
                            player.storage.sp_aya_fengmi.length = 0;
                            player.update();
                        },
                        sub: true,
                        sourceSkill: "sp_aya_fengmi",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "sp_aya_jizou": {
                enable: "phaseUse",
                filterCard: true,
                position: "he",
                prompt: "弃置一张牌并摸一张牌，然后将此牌对一名目标使用",
                check: function (card) {
                    var player = _status.event.player;
                    if (
                        game.hasPlayer(function (current) {
                            return (
                                player.canUse(card, current) &&
                                get.effect(current, card, player, player) > 0
                            );
                        })
                    )
                        return 6 - get.value(card);
                    return 4 - get.value(card);
                },
                content: function () {
                    "step 0";
                    player.draw().gaintag=["sp_aya_jizou"];
                    player.addTempSkill("sp_aya_jizou_target");
                    "step 1"
                    var cards=player.getCards('h',function(card){
                        return card.hasGaintag('sp_aya_jizou');
                    });
                    if(cards.length){
                        var next=player.chooseToUse();
                        next.set('filterCard',function(card){
                            return card.hasGaintag('sp_aya_jizou')&&_status.event.cards.includes(card);
                        });
                        next.set('cards',cards);
                        event.goto(0);
                    } else {player.phaseEnd();}
                },
                ai: {
                    order: 8.5,
                    threaten: 1.9,
                    result: {
                        player: 1,
                    },
                },
                group: ["sp_aya_jizou_usecard"],
                subSkill: {
                    usecard: {
                        trigger: {
                            player: "useCard",
                        },
                        forced: true,
                        popup: false,
                        filter: function (event,player){
                            if(!event.targets||!event.targets.length) return false;
                            if(_status.currentPhase!=player) return false;
                            return _status.event.name=='phaseUse'||_status.event.getParent('phaseUse').name=='phaseUse';
                        },
                        content: function (){
                            var target=trigger.targets;
                            player.storage.sp_aya_jizou_usecard=target;
                            player.markSkill('sp_aya_jizou_usecard');
                            game.log(player,'指定的最终目标是',target);
                        },
                        intro: {
                            content: "指定的最终目标是：$",
                        },
                        ai: {
                            threaten: 0.5,
                            expose: 0.2,
                        },
                        sub: true,
                        sourceSkill: "sp_aya_jizou",
                        "_priority": 0,
                    },
                    target: {
                        sub: true,
                        sourceSkill: "sp_aya_jizou",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "kyouko_echo": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "damageEnd",
                },
                filter: function (event,player){
                    return get.itemtype(event.cards) == "cards" && get.position(event.cards[0], true) == "o";
                    //return event.cards&&event.cards.length>0;
                },
                popup: false,
                content: function () {
                    "step 0"
                      if (trigger.card.name != "sha") {
                          player.gain(trigger.cards);
                          player.logSkill("kyouko_echo");
                          game.log(player, '收起了', trigger.cards);
                          event.finish();
                      } else {
                          player.chooseTarget('选择一名其他角色获得' + get.translation(trigger.cards), function (card, player, target) {
                              return target != player;
                          }).set('ai', function (target) {
                              var att = get.attitude(_status.event.player, target);
                              if (att > 0) return att + 1;
                              if (att == 0) return Math.random();
                              return att;
                          });}
                    "step 1"
                    if(result.bool){
                        var target=result.targets[0];
                        player.logSkill("kyouko_echo");
                        game.log(player, '将', trigger.cards,"交给了",target);
                        target.gain(trigger.cards,"gain2");
                    } else {
                        player.gain(trigger.cards);
                        player.logSkill("kyouko_echo");
                        game.log(player, '收起了', trigger.cards);}
                },
                ai: {
                    maixie: true,
                    "maixie_hp": true,
                    effect: {
                        target: function(card, player, target) {
                            if (player.hasSkillTag("jueqing", false, target)) return [1, -1];
                            if (get.tag(card, "damage")) return [1, 0.55];
                        },
                    },
                },
                "_priority": 0,
            },
            "kyouko_resonance": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "shaAfter",
                },
                direct: true,
                filter: function (event,player){
                    return event.targets&&event.targets.length;
                },
                content: function (){
                    'step 0'
                    player.chooseTarget(get.prompt2('kyouko_resonance'),//'选择一名角色，其可以对其'+get.translation(trigger.targets)+'使用一张杀且无视距离',
                                        function(card,player,target){
                        return target!=player;
                    }).ai=function(target){
                        var att=get.attitude(_status.event.player,target);
                        if(att>0) return att+1;
                        if(att==0) return Math.random();
                        return att;
                    };
                    'step 1'
                    if(result.bool){
                        player.logSkill('kyouko_resonance');
                        event.target=result.targets[0];
                        event.target.chooseToUse({name:'sha'},'共振：是否对'+get.translation(trigger.target)+'使用一张弹幕？').set('complexSelect',true).set('filterTarget',function(card,player,target){
                            if(target!=_status.event.sourcex&&!ui.selected.targets.contains(_status.event.sourcex)) return false;
                            return lib.filter.targetEnabled.apply(this,arguments);
                        }).set('sourcex',trigger.target).set('oncard',function(card){
                            if(!card.storage) card.storage={};
                            //card.storage.MYyijue=true;
                        });
                    }
                    else{
                        event.finish();
                    }
                },
                ai: {
                    expose: 0.2,
                    threaten: 1.4,
                },
                "_priority": 0,
            },
            "弹幕补丁": {
                mod: {
                    cardUsable: function(card, player, num) {
                        if (card.name == "sha") return num - 1;
                    },
                },
                charlotte: true,
                "_priority": 0,
            },
            "kanako_virtue": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseDrawBegin1",
                },
                filter: function (event,player){
                    return !event.numFixed;
                },
                direct: true,
                content: function (){
                    'step 0'
                    player.chooseTarget(get.prompt('kanako_virtue'),'令一名其他角色摸两张牌，并令其交给你一张牌。',function(card,player,target){
                        return target!=player;
                    }).set('ai',function(target){
                        return get.attitude(player,target);
                        //var att=get.attitude(_status.event.player,target);
                        //if(att>2){
                         //   if(target.hasSkillTag('nogain')) return att/10;
                          //  return 1-att;
                        //}
                        //return -1;        
                    });
                    'step 1'
                    if(result.bool){
                        trigger.cancel();
                        game.delay();
                        event.target=result.targets[0];
                        player.logSkill('kanako_virtue',result.targets);
                        //trigger.changeToZero();
                        event.target.draw(2);
                        
                    }
                    else{
                        event.finish();
                    }
                    'step 2'
                    if(event.target.countCards('he')){
                        event.target.chooseCard('请选择一张交给'+get.translation(player)+'','h',true)
                            .set('ai',function(card, cards){
                            if(get.attitude(target, player) > 0){
                                if (get.suit(card) == 'heart') return 1*(10 - get.value(card));
                                if (get.suit(card) != 'heart') return -1;
                            } else {
                            if (get.suit(card) == 'heart') return -1;
                            if (get.suit(card) != 'heart') return 1*(3 - get.value(card));
                            }
                      });
                    }else{
                        event.finish();
                    }
                    'step 3'
                    if(result.bool){
                        var card = result.cards[0];
                        event.card = card;
                        target.showCards(card);
                        target.give(card, player).delay = false;
                        if (get.suit(card) == "heart") player.draw();
                        //event.target.$give(1,player);
                        //event.target.line(player,'green');
                        //player.gain(result.cards,event.target);
                    }
                    else{
                        event.finish();
                    }
                },
                ai: {
                    threaten: 0.8,
                    expose: 0.2,
                },
                "_priority": 0,
            },
            "kanako_faith": {
                audio: "ext:车万符斗祭:1",
                unique: true,
                enable: "phaseUse",
                mark: false,
                limited: true,
                filterTarget: function (card, player, target) {
                    return target != player && get.distance(player, target, "attack") <= 1;
                },
                selectTarget: -1,
                multitarget: true,
                multiline: true,
                intro: {
                    content: "limited",
                },
                skillAnimation: false,
                init: (player, skill) => (player.storage[skill] = false),
                content: function () {
                    "step 0"
                    player.awakenSkill("kanako_faith");
                    targets.sort(lib.sort.seat);
                    event.targets = targets;
                    "step 1"
                    if (event.targets.length) {
                        var target = event.targets.shift();
                        event.target = target;
                        //选择
                        target.chooseControl('献上信仰', '拆台')
                            .set('prompt', `###请选择一项###${lib.translate.kanako_faith_info}`)
                            .set('ai', function () {
                            if (get.attitude(_status.event.player, _status.event.getParent().player) > 0) return 0;
                            return 1;
                        });
                    } else {
                        event.finish();
                    }
                    "step 2"
                    if (result.index == 0) {
                        //摸牌的场合
                        event.target.line(player);
                        game.log(event.target,"献上了信仰！");
                            //event.target, '令', player, '摸了一张牌');
                        player.draw();
                    } else {
                        //弃牌的场合
                        game.log(event.target,"选择了拆台！");
                        event.target.discardPlayerCard(player, 'he', true).boolline = true;
                        event.goto(4);
                    }
                    "step 3"
                    event.goto(1);
                    "step 4"
                    var prompt = get.translation(event.target);
                    var choiceList = [
                        '视为对' + prompt + '使用一张杀',
                        '视为对' + prompt + '使用一张决斗'
                    ];
                    player.chooseControl(function () {
                        return Math.random() < 0.5 ? "选项一" : "选项二";
                    })
                        .set('prompt', '对' + get.translation(event.target) + '发动【信仰】')
                        .set('choiceList', choiceList)
                        .set('ai', function () {
                        var player = _status.event.player;
                        var target = _status.event.getParent().target;
                        if (get.effect(target, { name: 'sha' }, player, player) > get.effect(target, { name: 'juedou' }, player, player)) 
                            return "选项一";
                        return "选项二";
                    })
                    "step 5"
                    var card;
                    switch (result.control) {
                        case '选项一': card = { name: 'danmaku_faith', isCard: true }; break;
                        case '选项二': card = { name: 'juedou', isCard: true }; break;
                    }
                    player.useCard(card, event.target, false);
                    //player.storage.ganjin += 1;
                    event.goto(1);
                  },
                ai: {
                    order: 4.5,
                    result: {
                        player: function (player, target) {
                            var num = 0;
                            var list = [];
                            var listnum = 0;
                            for (var i = 0; i < game.players.length - 1; i++) {
                              list.push('0');
                            }
                            for (var i = 0; i < game.players.length; i++) {
                              num += game.players[i].num('h');
                            }
                            var max = function () {
                              for (var i = 0; i < list.length; i++) {
                                if (list[i] > num) return true;
                              }
                              return false;
                            }
                            while (!max()) {
                              num--;
                              list[listnum % (game.players.length - 1)]++;
                              listnum++;
                            }
                            return num - player.countCards('h');
                          },
                        target: function (player, target) {
                            var num = 0;
                            var list = [];
                            var listnum = 0;
                            for (var i = 0; i < game.players.length - 1; i++) {
                              list.push('0');
                            }
                            for (var i = 0; i < game.players.length; i++) {
                              num += game.players[i].num('h');
                            }
                            var max = function () {
                              for (var i = 0; i < list.length; i++) {
                                if (list[i] > num) return true;
                              }
                              return false;
                            }
                            while (!max()) {
                              num--;
                              list[listnum % (game.players.length - 1)]++;
                              listnum++;
                            }
                            for (var i = 0; i < game.players.length; i++) {
                              if (target == game.players[i]) var nu = i;
                            }
                            return list[nu - 1] - target.countCards('h');
                          },
                    },
                },
                "_priority": 0,
            },
            "minoriko_foison": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseDrawBegin2",
                },
                forced: true,
                filter: function (event,player){
                    return !event.numFixed;
                },
                content: function (){
                    if(player.countCards('h')<4){
                        trigger.num=5-player.countCards('h');
                    }
                },
                "_priority": 0,
            },
            "minoriko_autumnfeast": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                viewAs: {
                    name: "wugu",
                },
                usable: 1,
                filterCard: {
                    color: "red",
                },
                position: "hes",
                selectCard: 2,
                complexCard: true,
                filter: function(event, player) {
                    return player.countCards('hes', {
                        color: 'red'
                    }) > 0;
                },
                check: function (card) {
                    return 8 - get.value(card);
                },
                ai: {
                    wuxie: function() {
                        if (Math.random() < 0.5) return 0;
                    },
                    basic: {
                        order: 3,
                        useful: 0.5,
                    },
                    result: {
                        target: function(player, target) {
                            if (get.is.versus()) {
                                if (target == player) return 1.5;
                                return 1;
                            }
                            if (player.hasUnknown(2)) {
                                return 0;
                            }
                            return (1 - get.distance(player, target, 'absolute') / game.countPlayer()) * get.attitude(player, target) > 0 ? 0.5 : 0.7;
                        },
                    },
                    tag: {
                        draw: 1,
                        multitarget: 1,
                    },
                },
                "_priority": 0,
            },
            "minoriko_akitribute": {
                audio: "ext:车万符斗祭:1",
                forced: true,
                popup: false,
                trigger: {
                    global: "wuguContentBeforeAfter",
                },
                priority: 5,
                filter: function(event, player) {
                    if (event.card.name != 'wugu') return false;
                    if (!event.targets.includes(player)) return false;
                    if (event.targets[0] == player) return false;
                    return true;
                },
                content: function() {
                    game.playAudio("../extension/车万符斗祭/",'minoriko_autumnfeast1');
                    var evt = trigger.getParent();
                    evt.targets.remove(player);
                    evt.targets.unshift(player);
                },
                group: ["minoriko_akitribute_gain"],
                subSkill: {
                    gain: {
                        trigger: {
                            global: "wuguRemained",
                        },
                        filter: function(event) {
                            return event.remained.filterInD().length > 0;
                        },
                        direct: true,
                        content: function() {
                            "step 0";
                            var du = 0;
                            for (var i = 0; i < trigger.remained.length; i++) {
                                if (trigger.remained[i].name == "du") du++;
                            }
                            var dialog = ui.create.dialog(get.prompt2("minoriko_akitribute"), trigger.remained, "hidden");
                            dialog.classList.add("noselect");
                            player.chooseTarget(dialog).set("ai", function (target) {
                                var trigger = _status.event.getTrigger();
                                var player = _status.event.player;
                                var att = get.attitude(player, target);
                                if (du >= trigger.remained.length / 2) return -att;
                                return att;
                            });
                            "step 1";
                            if (result.bool) {
                                var cards = trigger.remained.card;
                                player.logSkill("minoriko_akitribute", result.targets);
                                result.targets[0].gain(trigger.remained.slice(0), "gain2", "log");
                                result.targets[0].addShownCards(trigger.remained.slice(0), "gain2", "visible_cards");
                                trigger.remained.length = 0;
                            }
                        },
                        audio: "minoriko_akitribute",
                        sub: true,
                        sourceSkill: "minoriko_akitribute",
                        "_priority": 0,
                    },
                },
                "_priority": 500,
            },
            "minoriko_foison_old": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseDrawAfter",
                },
                firstDo: true,
                direct: true,
                content: function (){
                    player.logSkill("minoriko_foison");
                },
                group: ["minoriko_foison_draw"],
                subSkill: {
                    draw: {
                        trigger: {
                            player: "phaseDrawAfter",
                        },
                        filter: function (event,player){
                            return player.countCards('h')<5;
                        },
                        forced: true,
                        popup: false,
                        content: function (){
                            player.draw(5-player.countCards('h'));
                        },
                        ai: {
                            threaten: 1.3,
                        },
                        sub: true,
                        sourceSkill: "minoriko_foison_old",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "shizuha_decay": {
                audio: "ext:车万符斗祭:1",
                forced: true,
                trigger: {
                    global: "loseEnd",
                },
                filter: function (event, player) {
                    if (_status.currentPhase != player) return false;
                    if (event.player == player) return false;
                    if (event.player.countCards('h')) return false;
                    return event.hs && event.hs.length > 0;
                },
                content: function () {
                    player.draw();
                },
                ai: {
                    threaten: 1.5,
                },
                group: ["shizuha_decay_1"],
                subSkill: {
                    "1": {
                        trigger: {
                            player: "damageEnd",
                        },
                        filter: function (event, player) {
                            if (_status.currentPhase == player) return false;
                            return event.source && event.source != player && event.source.isAlive();
                        },
                        direct: true,
                        forced: true,
                        logTarget: "source",
                        content: function () {
                            var target = trigger.source;
                            target.addTempSkill('shizuha_decay_2', { player: 'phaseEnd' });
                        },
                        ai: {
                            "maixie_defend": true,
                            effect: {
                                target: function (card, player, target) {
                                    if (player.hasSkillTag('jueqing', false, target)) return;
                                    return 0.8;
                                },
                            },
                        },
                        sub: true,
                        sourceSkill: "shizuha_decay",
                        "_priority": 0,
                    },
                    "2": {
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/shizuha_decay.png >",
                        intro: {
                            content: "你的弃牌阶段额外弃置一张手牌。",
                        },
                        audio: "shizuha_decay",
                        trigger: {
                            player: "phaseDiscardBegin",
                        },
                        forced: true,
                        direct: true,
                        content: function(){
                            game.playAudio("../extension/车万符斗祭/",'shizuha_decay1');
                            game.log("【","<font color=#66CCff>",get.translation("shizuha_decay"),"</font>","】发动了...");
                        },
                        mod: {
                            maxHandcard: function (player, num) {
                                return num - 1;
                            },
                        },
                        sub: true,
                        sourceSkill: "shizuha_decay",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "shizuha_autumnwind": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseDiscardEnd",
                },
                direct: true,
                filter: function (event, player) {
                    return (
                        event.cards &&
                        event.cards.length > 0 &&
                        game.hasPlayer(function (current) {
                            return current.countCards("he") && current != player;
                        })
                    );
                },
                content: function () {
                    "step 0"
                    player.chooseTarget(get.prompt('shizuha_autumnwind'), [1, trigger.num], function (card, player, target) {
                        return target.countCards('he') > 0;
                    }).set('ai', function (target) {
                        return -get.attitude(_status.event.player, target);
                    });
                    "step 1"
                    if (result.bool) {
                        //result.targets.sortBySeat();
                        event.targets = result.targets;
                        player.line(result.targets, 'green');
                        player.logSkill('shizuha_autumnwind', result.targets);
                    }
                    else event.finish();
                    "step 2"
                    var target = targets.shift();
                    player.discardPlayerCard(target, 'he', true)
                    if (targets.length) event.redo();
                },
                ai: {
                    expose: 0.2,
                },
                "_priority": 0,
            },
            "komachi_riverside": {
                audio: "ext:车万符斗祭:1",
                mod: {
                    globalFrom: function(from, to) {
                        if (to.hasSkill('komachi_riverside_mark')) return -Infinity;
                    },
                },
                enable: "phaseUse",
                usable: 1,
                position: "he",
                filterCard: true,
                selectCard: 1,
                filterTarget: function (card, player, target) {
                    return player != target;
                },
                content: function() {
                    "step 0"
                    target.addTempSkill('komachi_riverside_mark');
                    "step 1"
                    if (target.isMinHp()) {
                        player.chooseControl('摸牌', '弃牌', [0, 1].randomGet())
                            .set('prompt', `###请选择一项###${lib.translate.komachi_riverside_info}`)
                            .set('ai', function () {
                            var player = _status.event.player;
                            var target = _status.event.getParent().target;
                            if (get.attitude(player, target) > 0) 
                                return "摸牌";
                            return "弃牌";
                        })
                    } else {
                        event.finish();
                    }
                    "step 2"
                    if (result.index == 0){
                        player.draw();
                    } else {
                        player.discardPlayerCard(target, 'he', true);
                    }
                },
                ai: {
                    order: 8,
                    result: {
                        target: function (player, target) {
                            if (target.isMinHp()) return -1;
                            return 1;
                        },
                    },
                },
                subSkill: {
                    mark: {
                        mark: true,
                        marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/riverside.png >",
                        intro: {
                            content: "你与小町的距离变为1。",
                        },
                        sub: true,
                        sourceSkill: "komachi_riverside",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "komachi_awake": {
                audio: "ext:车万符斗祭:1",
                skillAnimation: false,
                unique: true,
                juexingji: true,
                derivation: ["komachi_ferryfee"],
                trigger: {
                    player: "phaseZhunbeiBegin",
                },
                forced: true,
                filter: function (event, player) {
                    return !player.storage.komachi_awake && player.countCards('h') > player.hp && player.hp < 3;
                  },
                init: function (player) {
                    player.storage.komachi_awake = false;
                  },
                content: function () {
                    player.awakenSkill('komachi_awake');
                    player.storage.komachi_awake = true;
                    player.loseMaxHp();
                    player.addSkills('komachi_ferryfee');
                  },
                ai: {
                    effect: {
                        target: function (card, player, target) {
                            if (get.tag(card, 'damage') && target.countCards('h') >= target.hp && target.hp > 1 && target.getDamagedHp() < 3) {
                              return [1, 1];
                            }
                          },
                    },
                },
                "_priority": 0,
            },
            "komachi_ferryfee": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    source: "damageEnd",
                },
                filter: function (event, player) {
                    return event.player != player && get.distance(player, event.player) <= 1 && event.player.countCards('he') > 0;
                },
                content: function () {
                    player.gainPlayerCard(get.prompt('komachi_ferryfee', trigger.player), trigger.player, 'he');
                    //.logSkill = ['komachi_ferryfee', trigger.player];
                },
                ai: {
                    effect: {
                        target: function (card, player, target, current) {
                            if (get.tag(card, 'damage') && target.countCards('he') > 0) {
                                return 0.5;
                            }
                        },
                    },
                },
                "_priority": 0,
            },
            "kokoro_hopemask": {
                audio: "ext:车万符斗祭:1",
                priority: -1,
                trigger: {
                    player: "phaseUseBegin",
                },
                check: function () {
                    return true;
                  },
                content: function(){
                    "step 0"
                    var num = 1 + player.getDamagedHp();
                    var cards = get.cards(num);
                    event.cards = cards;
                    game.cardsGotoOrdering(cards);
                    var next = player.chooseToMove();
                    next.set('list', [
                        ['牌堆顶', cards],
                        ['自己获得'],
                    ]);
                    next.set('prompt','希望之面：请调整牌序获得一种花色的牌并将剩余牌置于牌堆顶' );
                    next.set('filterOk',function(moved){
                        //if(moved[1].length==0) return false;
                        var suits=[];
                        for(var i=0;i<moved[1].length;i++){
                            suits.add(get.suit(moved[1][i]));
                        }
                        return suits.length<=1;
                    });
                    next.set('processAI', function (list) {
                        var cards = list[0][1].slice(0).sort(function (a, b) {
                            return get.value(b) - get.value(a);
                        });
                        return [cards.splice(1), cards];
                    });
                    "step 1"
                    var top = result.moved[0];
                    var gain = result.moved[1];
                    top.reverse();
                    for (var i = 0; i < top.length; i++) {
                        ui.cardPile.insertBefore(top[i], ui.cardPile.firstChild);
                    }
                    game.log(player, '将' + get.cnNumber(top.length) + '张牌置于牌堆顶');
                    game.updateRoundNumber();
                    player.showCards(gain);
                    player.gain(gain, 'draw');
                    //game.log(player, '获得了一张牌');
                },
                ai: {
                    threaten: 1.2,
                },
                "_priority": -100,
            },
            "kokoro_darknoh": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                filterTarget: function (card, player, target) {
                    return target.hp >= player.hp && target != player;
                },
                filterCard: function (card) {
                    return get.color(card) == 'black';
                },
                usable: 1,
                check: function (card) {
                    return 8 - get.value(card);
                },
                filter: function (event, player) {
                    return player.countCards('h', { color: 'black' });
                },
                discard: false,
                prepare: "give",
                content: function () {
                    "step 0"
                    target.gain(cards, player);
                    //player.give(cards, target);
                    //player.addShownCards(cards,"visible_cards");
                    //target.update();
                    target.addShownCards(cards,"visible_cards");
                    "step 1"
                    var num = target.countCards('h') - target.hp;
                    game.delay(2.0);
                    if (num > 0) {
                        target.chooseToDiscard('h', '请弃置' + get.cnNumber(num) + '张手牌', num, true)
                            //.set('prompt2', '请弃置' + get.cnNumber(num) + '张手牌')
                            .set('filterCard', function (card) {
                            return card != _status.event.cardx;})
                            .set('cardx', cards[0]);
                    }
                },
                ai: {
                    result: {
                        target: function (player, target) {
                            return 1;
                        },
                    },
                    order: 1,
                },
                "_priority": 0,
            },
            "seija_incite": {
                audio: "ext:车万符斗祭:2",
                enable: "phaseUse",
                usable: 1,
                filterTarget: function (card, player, target) {
                    return player != target;
                },
                selectTarget: 2,
                multitarget: true,
                multiline: true,
                line: "fire",
                content: function () {
                    "step 0"
                    player.chooseToCompare(targets[0]);
                    "step 1"
                    if (result.bool) {
                        targets[0].useCard({ name: 'sha' }, targets[1], 'noai').audio = false;
                    }
                    else {
                        targets[0].chooseBool('是否视为对'+get.translation(player)+'使用一张杀？').set('ai', function () {
                            var evt = _status.event.getParent();
                            return get.effect(evt.target, { name: 'sha' }, evt.player, evt.player) > 0;
                        });
                    }
                    "step 2"
                    if (result.bool) {
                        targets[0].useCard({ name: 'sha' }, player, 'noai').audio = false;
                    }
                },
                ai: {
                    order: 3,
                    result: {
                        target: -1,
                        player: function (player) {
                            return player.isLinked() ? 0 : -0.8;
                        },
                    },
                    expose: 0.3,
                    threaten: 1.3,
                },
                "_priority": 0,
            },
            "seija_reversal": {
                audio: "ext:车万符斗祭:1",
                popup: false,
                trigger: {
                    target: "shaBegin",
                },
                check: function (event, player) {
                    return get.attitude(player, event.player) < 0;
                },
                logTarget: "player",
                content: function () {
                    "step 0";
                    player.draw();
                    "step 1";
                    if (player.countCards("h") > trigger.player.countCards("h")) {
                        trigger.untrigger();
                        trigger.finish();
                        var targets = [player];
                        trigger.player.line(targets, "green");
                        var card = { name: "juedou", isCard: true };
                        if (trigger.player.canUse(card, player)) trigger.player.useCard(card, player).audio = false;
                        player.logSkill("seija_reversal");
                    } else event.finish();
                },
                ai: {
                    effect: {
                        target: function (card, player, target, current) {
                            if (card.name == "sha") return [1, 0.5];
                        },
                    },
                },
                "_priority": 0,
            },
            "alice_legion": {
                trigger: {
                    player: "phaseDiscardBefore",
                },
                direct: true,
                content: function () {
                    "step 0"
                    player.chooseCard(get.prompt2('alice_legion'), 'he', function (card) {
                        return get.type(card) == 'equip';
                    }).set('ai', function (card) {
                        if (card.subtype == "equip1") return 10 - get.value(card);
                        return 6 - get.value(card);
                    });
                    "step 1"
                    if (result.bool) {
                        var card = result.cards[0];
                        event.card = card;
                        switch (get.subtype(card)) {
                            case 'equip1': player.chooseTarget('小小军势：选择一个目标，并对其使用一张杀', function (card, player, target) {
                                return target != player;
                            }).set('ai', function (target) {
                                return -get.attitude(_status.event.player, target);
                            }); break;
                            case 'equip2': player.chooseTarget('小小军势：选择一个目标并令其回复1点体力', function (card, player, target) {
                                return target;//target.hp < target.maxHp;
                            }).set('ai', function (target) {
                                return get.attitude(_status.event.player, target);
                            }); break;
                            case 'equip3': player.chooseTarget('小小军势：选择【人形操控】的目标', function (card, player, target) {
                                return target != player && target.getEquip(1) && player.canUse({ name: 'sha' }, target, false);
                            }).set('ai', function (target) {
                                var card = _status.event.getParent().card;
                                return get.effect(target, { name: 'jiedao' }, player, player);
                            }); break;
                            case 'equip4': player.chooseTarget('小小军势：选择【人形操控】的目标', function (card, player, target) {
                                return target != player && target.getEquip(1) && player.canUse({ name: 'sha' }, target, false);
                            }).set('ai', function (target) {
                                var card = _status.event.getParent().card;
                                return get.effect(target, { name: 'jiedao' }, player, player);
                            }); break;
                            case 'equip5': player.draw(); player.skip('phaseDiscard'); game.playAudio("../extension/车万符斗祭/",'alice_legion_hold.ogg'); event.finish(); break;
                        }
                    }
                    else {
                        event.finish();
                    }
                    "step 2"
                    if (result.bool) {
                        var target = result.targets[0];
                        //player.logSkill('alice_legion', target);
                        player.recast(event.card);
                        if (get.subtype(event.card) == 'equip1') {
                            var next = player.useCard({ name: 'sha' }, target, false);
                            next.animate = false;
                            next.audio = false;
                            game.playAudio("../extension/车万符斗祭/",'alice_legion_attack.ogg');
                        }
                        if (get.subtype(event.card) == 'equip2') {
                            target.recover();
                            game.playAudio("../extension/车万符斗祭/",'alice_legion_cover.ogg');
                        }
                        if (get.subtype(event.card) == 'equip3'||get.subtype(event.card) == 'equip4') {
                            var targets = result.targets[0];
                            var next = player.useCard({ name: 'jiedao' }, targets);
                            next.animate = false;
                            next.audio = false;
                            game.playAudio("../extension/车万符斗祭/",'alice_legion_control.ogg');
                        }
                    }
                },
                "_priority": 0,
            },
            "alice_dollblast": {
                trigger: {
                    player: "loseAfter",
                    global: "gainAfter",
                },
                filter: function (event, player) {
                    for (var i = 0; i < event.cards.length; i++) {
                        if (get.type(event.cards[i]) != "equip" && get.position(event.cards[i]) != "e") {
                            return false;}}
                    if (event.player == player) return false;
                    if (event.name == 'lose') {
                        return event.type == 'discard' && event.cards2 && event.cards2.length > 0;
                    }
                    else {
                        var cards = event.getl(player).cards;
                        return cards && cards.length > 0;
                    }
                },
                content: function () {
                    'step 0'
                    if (trigger.delay == false) game.delay();
                    'step 1'
                    var next = player.discardPlayerCard('he', true, player,trigger.player);
                    next.logSkill = ['alice_dollblast', trigger.player];
                    if(trigger.player.countCards("h", card => card.isInPile())){
                        game.playAudio("../extension/车万符斗祭/",'alice_dollblast_blast.ogg');
                    } else {
                        game.playAudio("../extension/车万符斗祭/",'alice_dollblast_noblast.ogg');
                    }
                    'step 2'
                    event.target = trigger.player;
                    event.card = result.links[0];
                    var history = event.target.actionHistory[
                        event.target.actionHistory.length - 1
                    ];
                    for (var i = 0; i < history.gain.length; i++) {
                        if (history.gain[i].cards && history.gain[i].cards.length > 0) {
                            if (history.gain[i].cards[0] == event.card) {
                                event.target.damage(player);
                                break;
                            }
                        }
                    }
                },
                ai: {
                    threaten: 1.5,
                    effect: {
                        target: function (card, player, target, current) {
                            if (player.countCards('h') > 1 && get.tag(card, 'discard')) return [1, 0, 1, -1];
                        },
                    },
                },
                group: ["alice_dollblast_discard"],
                subSkill: {
                    discard: {
                        trigger: {
                            player: "discardAfter",
                        },
                        filter: function (event,player){
                            for (var i = 0; i < event.cards.length; i++) {
                                if (event.cards[i].original != 'e') return false;
                            }
                            var evt=event.getParent();
                            if(!evt||!evt.player) return false;
                            if(evt.player==player) return false; 
                            return evt.player.isIn()&&evt.player.countCards('he')>0;
                        },
                        content: function (){
                            'step 0'
                            if(trigger.delay==false) game.delay();
                            event.tar=trigger.getParent().player;
                            'step 1'
                            player.line(event.tar,'green');
                            player.discardPlayerCard(1,event.tar,true);
                            game.playAudio("../extension/车万符斗祭/",'alice_dollblast_noblast.ogg');
                        },
                        sub: true,
                        sourceSkill: "alice_dollblast",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "rumia_darkness": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                filter: function(event, player) {
                    return game.countPlayer(current => current != player) > 1;
                },
                check: function(card) {
                    return 10 - get.value(card);
                },
                filterCard: true,
                position: "he",
                filterTarget: function(card, player, target) {
                    if (player == target) return false;
                    //if (ui.selected.targets.length == 1) {
                    //    return target.canUse({ name: "sha" }, ui.selected.targets[0]);
                    //}
                    return 2;
                },
                targetprompt: ["攻击者","被攻击者"],
                selectTarget: 2,
                multitarget: true,
                content: function() {
                    "step 0"
                    game.delay(0.5);
                    event.targets[0].chooseToUse('黑暗：对' + get.translation(event.targets[1]) + '使用一张弹幕，或受到来自' + get.translation(player) +'的1点伤害。',{
                        name: "sha",
                        isCard: true,
                    }, event.targets[0], event.targets[1]);
                        //.set("complexSelect",true);
                    "step 1"
                    if (!result.bool) {
                        event.targets[0].damage();
                    }
                },
                ai: {
                    order: 5,
                    result: {
                        target: function(player, target) {
                            if (ui.selected.targets.length == 0) {
                                return -3;
                            } else {
                                return get.effect(target, { name: "sha" }, ui.selected.targets[0], target);
                            }
                        },
                        player: function (player) {
                            var num = game.countPlayer(function (current) {
                                return current != player;
                            });
                            if (num > 2) {
                                if (player.hp <= 1) return 0;
                                return 1;
                            }
                            if (num == 2) {
                                if (player.hp <= 1) return 0;
                                if (player.countCards("h") == 0) return 0;
                                return 1;
                            }
                            return 0;
                        },
                    },
                    expose: 0.4,
                    threaten: 3,
                },
                "_priority": 0,
            },
            "rumia_cheat": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseJieshuBegin",
                },
                frequent: true,
                preHidden: true,
                content: async function(event, trigger, player) {
                    player.draw();
                },
                "_priority": 0,
            },
            "mamizou_morph": {
                audio: "ext:车万符斗祭:1",
                enable: "phaseUse",
                usable: 1,
                hiddenCard: function(player, name) {
                    const cardType = get.type(name); // 动态获取目标卡牌类型
                    //if (get.type(name) != "basic") return false;
                    if (cardType != "basic" && cardType != "trick") return false; // 允许基本和锦囊
                    if (!player.storage.mamizou_morph && player.countCards("hes") < 2) return false;
                    return player.hasCard(function (card) {
                        //return get.type(card) == "basic";
                        return get.type(card) == cardType; // 动态匹配类型
                    }, "hs");
                },
                filter: function(event, player) {
                    if (!player.storage.mamizou_morph && player.countCards("hes") < 2) return false;
                    if (
                        !player.hasCard(function (card) {
                            //return get.type(card) == "basic";
                            return ["basic", "trick"].includes(get.type(card)); // 扩展类型检测
                        }, "hs")
                    )
                        return false;
                    for (var name of lib.inpile) {
                        const currentType = get.type(name);
                        //if (get.type(name) != "basic") continue;
                        if (!["basic", "trick"].includes(currentType)) continue; // 双类型支持
                        if (event.filterCard(get.autoViewAs({ name }, "unsure"), player, event)) return true;
                        if (name == "sha") {
                            for (var nature of lib.inpile_nature) {
                                if (event.filterCard(get.autoViewAs({ name, nature }, "unsure"), player, event)) return true;
                            }
                        }
                    }
                    return false;
                },
                chooseButton: {
                    dialog: function(event, player) {
                        var list = [];
                        for (var name of lib.inpile) {
                            if ((get.type(name) != "basic") && (get.type(name) != "trick")) continue;
                            if (event.filterCard(get.autoViewAs({ name }, "unsure"), player, event)) {
                                if (get.type(name) == "basic")
                                    list.push(["基本", "", name]);
                                else list.push(["符卡", "", name]);
                            }
                            if (name == "jiu") { 
                                //酒的替换
                                list.pop(name);
                                list.push("card_wine"); 
                            }
                           //属性杀 if (name == "sha") {
                           //     for (var nature of lib.inpile_nature) {
                           //         if (event.filterCard(get.autoViewAs({ name, nature }, "unsure"), player, event)) list.push(["基本", "", "sha", nature]);
                          //      }
                          //  }
                        }
                        return ui.create.dialog("变化", [list, "vcard"], "hidden");
                    },
                    backup: function(links, player) {
                        const selectedType = get.type(links[0][2]); // 获取选中卡牌的实际类型
                        return {
                            audio: "mamizou_morph",
                            filterCard(card, player, target) {
                                if (player.storage.mamizou_morph) 
                                    return selectedType; // 动态类型检测
                                else if (ui.selected.cards.length) {
                                    const firstType = get.type(ui.selected.cards[0]);
                                    if (firstType == selectedType) return true;
                                    else if (selectedType == "trick" && firstType == "delay") return true; //延时牌也作为锦囊牌
                                    return get.type(card) == selectedType;
                                }
                                return true;
                            },
                            complexCard: true,
                            selectCard() {
                                return 2;
                            },
                            check(card, player, target) {
                                if (!ui.selected.cards.length && get.type(card) == "basic") return 6;
                                else return 6 - get.value(card);
                            },
                            viewAs: { name: links[0][2], nature: links[0][3] },
                            position: "hes",
                            popname: true,
                        };
                    },
                    prompt: function(links, player) {
                        const targetType = get.type(links[0][2]);
                        const typeName = targetType == "basic" ? "基本牌" :
                        targetType == "trick" ? "符卡" : "";
                        var str = player.storage.mamizou_morph ? `一张${typeName}` : `两张手牌(其中至少应有一张${typeName})`;
                        return "将" + str + "当做" + get.translation(links[0][3] || "") + get.translation(links[0][2]) + "使用或打出";
                    },
                },
                ai: {
                    order: function() {
                        var player = _status.event.player;
                        var event = _status.event;
                        if (event.filterCard({ name: "jiu" }, player, event) && get.effect(player, { name: "jiu" }) > 0 && player.countCards("hs", { type: "basic" }) > 2) {
                            return 3.3;
                        }
                        return 3.1;
                    },
                    skillTagFilter: function(player, tag, arg) {
                        if (tag == "fireAttack") return true;
                        if (player.countCards("hes") < 2) return false;
                        if (
                            !player.hasCard(function (card) {
                                return get.type(card) == "basic";
                            }, "hes")
                        ) {
                            return false;
                        }
                    },
                    result: {
                        player: 1,
                    },
                    fireAttack: true,
                },
                "_priority": 0,
            },
            "keine_teach": {
                audio: "ext:车万符斗祭:2",
                enable: "phaseUse",
                usable: 1,
                filter: function (event, player) {
                  return player.countCards("he") > 0;
                },
                filterCard: function(card, player) {
                    return player.countCards("he");
                },
                delay: false,
                discard: false,
                lose: false,
                position: "he",
                content: function () {
                    'step 0'
                    player.recast(event.cards);
                    var next = player.chooseCardTarget({
                        filterCard: true,
                        selectCard: 1,
                        filterTarget: function (card, player, target) {
                            return target != player;
                        },
                        ai1: function (card) {
                            return get.value(card);
                        },
                        ai2: function (target) {
                            var att = get.attitude(_status.event.player, target);
                            if (_status.event.player.countCards('h') > _status.event.player.countCards('e')) {
                                if (att < 0) {
                                    return att - 5;
                                }
                                return -1;
                            }
                            else {
                                if (att > 0) {
                                    return att + 3;
                                }
                                return 0;
                            }
                        },
                        prompt: '请选择要交给一名其他角色的牌'
                    });
                    "step 1"
                    if (result.bool) {
                        _status.event.target = result.targets[0]
                        player.line(result.targets[0]);
                        result.targets[0].gain(result.cards, player);
                        player.$give(result.cards.length, result.targets[0]);
                        game.delay(1.5);
                        var next = result.targets[0].chooseToUse();
                        next.prompt = '请选择你要使用的牌，否则重铸一张牌';
                    }
                    "step 2"
                    if (!result.bool){
                        _status.event.target.chooseCard("he", true, "请重铸一张牌", lib.filter.cardRecastable);
                    }
                    else event.finish();
                    "step 3"
                    if (result.bool){
                        _status.event.target.recast(result.cards);
                    }
                },
                "_priority": 0,
            },
            "keine_guard_awake": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    player: "phaseUseBegin",
                },
                limited: true,
                unique: true,
                priority: -1,
                skillAnimation: false,
                filter: function (event, player) {
                    return game.hasPlayer(function (current) {
                        return current != player && current.isDamaged();
                    });
                },
                check: function(){return false;},
                content: function () {
                    'step 0'
                    //player.loseMaxHp();
                    player.maxHp--;
                    player.update();
                    event.target = [];
                    player.storage.keine_guard_awake = true;
                    player.awakenSkill('keine_guard_awake');
                    'step 1'
                    player.chooseTarget(true, function (card, player, target) {
                        return target != player && target.isDamaged();
                    }, '选择【守护】的目标').set('ai', function (target) {
                        var player = _status.event.player;
                        if (get.attitude(player, target) > 2) {
                            return get.recoverEffect(target, player, player);
                        }
                        return 0;
                    });
                    'step 2'
                    if (result.bool) {
                        result.targets[0].recover();
                        event.target = result.targets[0];
                    }
                    else {
                        event.finish();
                    }
                    'step 3'
                    if (event.target.isMinHp()) {
                        player.storage.keine_devour = target;
                        event.target.storage.keine_devour_current2 = player;
                        player.markSkill('keine_devour');
                        player.addSkill("keine_devour");
                        event.target.markSkill("keine_devour_current2");
                        event.target.addSkill("keine_devour_current2");
                        //player.addSkill('rende');
                        //event.target.addSkill('rende');
                    }
                },
                ai: {
                    order: 1,
                },
                "Fool_skillColor": "DarkRed",
                mark: true,
                init: (player, skill) => (player.storage[skill] = false),
                intro: {
                    content: "limited",
                },
                "_priority": -100,
            },
            "keine_devour": {
                audio: "ext:车万符斗祭:3",
                trigger: {
                    global: "damageBegin4",
                },
                filter: function(event, player) {
                    var target = player.storage.keine_devour;
                    if (!target || !target.isIn()) return false;
                    var list = event.keine_devour || [];
                    //var list = event.keine_devour_current2无限套 || [];
                    var list2 = [player, target];
                    return list2.includes(event.player) && list2.some(current => event.player != current && !list.includes(current));
                },
                direct: true,
                content: function*(event, map) {
                    var player = map.player, trigger = map.trigger;
                    var target = player.storage.keine_devour;
                    var current = trigger.player == player ? target : player;
                    if (current.hp > trigger.player.hp) { 
                    //var result = yield current.chooseBool('决意：是否代替' + get.translation(trigger.player) + '承受本次伤害？').set('choice', lib.skill.twgonghuan.check(trigger, current));
                    //if (result.bool) {
                        current.logSkill('keine_devour', trigger.player);
                        game.log(current, '为', trigger.player, '承受了此次伤害');
                        var list = trigger.keine_devour_current2 ? trigger.keine_devour.slice() : [];
                        list.addArray([player, target]);
                        trigger.cancel();
                        current.damage(trigger.source ? trigger.source : 'nosource', trigger.nature, trigger.num).set('card', trigger.card).set('cards', trigger.cards).keine_devour = list;
                    //}
                    }
                },
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/keine_devoted.gif >",
                intro: {
                    content: "已指定$为“决意”角色",
                },
                group: ["keine_devour_current"],
                subSkill: {
                    current: {
                        audio: "keine_devour",
                        trigger: {
                            global: ["drawAfter","recoverAfter"],
                        },
                        filter: function (event, player) {
                            return _status.currentPhase == player && event.player.hasSkill('keine_devour_current2');
                        },
                        forced: true,
                        content: function () {
                            if (trigger.name == "draw") {
                                player.draw(trigger.num);
                            }
                            if (trigger.name == "recover"){
                                player.recover(trigger.num);
                            }
                            else event.finish();
                        },
                        sub: true,
                        sourceSkill: "keine_devour",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "keine_devour_current2": {
                marktext: "<img style=width:25px src=extension/车万符斗祭/image/tag/keine_devoted.gif >",
                intro: {
                    content: "你已成为$的“决意”角色",
                },
                audio: "keine_devour",
                trigger: {
                    global: ["drawAfter","recoverAfter"],
                },
                filter: function (event, player) {
                    return _status.currentPhase == player && event.player.hasSkill('keine_devour_current');
                },
                forced: true,
                content: function () {
                    if (trigger.name == "draw") {
                        player.draw(trigger.num);
                    }
                    if (trigger.name == "recover"){
                        player.recover(trigger.num);
                    }
                    else event.finish();
                },
                "_priority": 0,
            },
            "skill_exinwan1": {
                trigger: {
                    global: ["loseAfter","addJudgeAfter","gainAfter","loseAsyncAfter"],
                    player: ["compare"],
                    target: "loseAfter",
                },
                cardSkill: true,
                filter: function(event, player, name) {
                    if (name == "compare") {
                        if (player == event.player) {
                            if (event.iwhile > 0) return false;
                            return event.card1.name == "card_exinwan";
                        }
                        return event.card2.name == "card_exinwan";
                    }
                    if (event.name != "equip" && !event.visible) return false;
                    var evt = event.getl(player);
                    if (
                        !evt ||
                        !evt.hs ||
                        !evt.hs.filter(function (i) {
                            return get.name(i, player) == "card_exinwan";
                        }).length
                    )
                        return false;
                    return true;
                },
                forced: true,
                popup: true,
                content: function() {
                    "step 0";
                    if (trigger.delay === false) game.delayx();
                    "step 1";
                    if (typeof trigger.getl == "function") {
                        var num = 0;
                        num = trigger.getl(player).hs.filter(function (i) {
                            return get.name(i, player) == "card_exinwan";
                        }).length;
                    }
                    //player.loseHp(num).type = "card_exinwan";
                    event.num = num;
                     "step 2"
                    //event.numx = 0;
                    //for(var i=0;i<trigger.cards.length;i++){
                        //if(get.position(trigger.cards[i])=='d'&&trigger.cards[i].name=='tao'){
                       //    event.numx++;
                       // }
                   // }
                    game.playAudio("../extension/车万符斗祭/",'card_exinwan');
                    game.log(player, "被", "#g【恶心丸】", "恶心到了...");
                    var next=player.chooseToDiscard(2,'h','请弃置两张手牌,否则受到一点无来源伤害。');
                    next.set('ai',function(card){
                        var player=_status.event.player;
                        if(player.hp==1) return 8-get.value(card);
                        if(player.hp==2) return 7-get.value(card);
                        return 6-get.value(card);
                    }).type = "card_exinwan";
                    "step 3"
                    if(!result.bool){
                        player.damage('nosource').type = "card_exinwan";
                    }
                    "step 4"
                    if(event.num > 1){
                        event.num--;
                        game.playAudio("../extension/车万符斗祭/",'card_exinwan');
                        event.goto(2);
                    }
                },
                "_priority": -50,
            },
            startx: {
                trigger: {
                    global: "enterGame",
                },
                global: "skill_exinwan1",
                content: function(){
                    //global: "skill_exinwan1",
                },
                "_priority": 0,
            },
            "yukari_spiritaway": {
                audio: "ext:车万符斗祭:2",
                enable: "phaseUse",
                usable: 2,
                filterTarget: function(card, player, target) {
                    return target.countCards("hej") > 0;
                },
                content: function() {
                    "step 0";
                    // 初始化存储为数组（如果尚未初始化）
                    if (!Array.isArray(target.storage.yukari_spiritaway2)) {
                        target.storage.yukari_spiritaway2 = [];
                    }
                    //event.cards = target.getCards("hej");
                    //player.chooseCardButton(target,"hej", true, '选择要神隐的牌').set('ai', get.buttonValue);
                    player.choosePlayerCard("hej", true, "请选择要对" +"<font color=#66CCff>"+get.translation(target)+"</font>" +"神隐的牌", function (button) {
                        if (get.attitude(player, targets[0]) > get.attitude(player, targets[1])) {
                            return get.position(button.link) == "j" ? 10 : 0;
                        } else {
                            if (get.position(button.link) == "j") return -10;
                            return get.equipValue(button.link);
                        }
                    },
                                            targets[0]);
                    "step 1"
                    if (result.bool){
                        var card = result.links[0];
                        //event.card = card;
                        if (get.position(result.buttons[0].link) == "j"){
                            //target.loseHp();
                            ui.special.appendChild(card);
                        }
                       // } else {
                        //var js = target.getCards('j');
                        //if (js.length) {
                            //ui.discardPile.appendChild(card);
                        //}
                        //ui.special.appendChild(card);
                        //event.card.fix();
                        target.lose(card, ui.special);
                        //target.addToExpansion(card, player, "giveAuto").gaintag.add("yukari_spiritaway2");
                        //target.addToExpansion("$giveAuto", card, target).gaintag.add("yukari_spiritaway2");
                        target.update();
                        //target.storage.yukari_spiritaway2 = card;
                        // 将卡牌添加到存储数组中
                        target.storage.yukari_spiritaway2.push(card); // 追加新卡牌
                        target.addSkill("yukari_spiritaway2");
                    }
                },
                ai: {
                    order: 10,
                    value: 7,
                    useful: [3,1],
                    result: {
                        target: function(player, target) {
                            if (target.hasSkillTag("noh")) return 3;
                            var num = -Math.sqrt(target.countCards("h"));
                            if (player.hasSha() && player.canUse("sha", target)) {
                                num -= 2;
                            }
                            return num;
                        },
                    },
                },
                "_priority": 0,
            },
            "yukari_spiritaway2_o": {
                trigger: {
                    global: "phaseEnd",
                    player: "dieBegin",
                },
                lastDo: true,
                popup: false,
                forced: true,
                charlotte: true,
                sourceSkill: "yukari_spiritaway",
                audio: "ext:车万符斗祭:0",
                marktext: "隐",
                intro: {
                    markcount: "expansion",
                    content: "cards",
                    mark: function(dialog, current, player) {
                        var cards = player.getExpansions("yukari_spiritaway2");
                        if (player.isUnderControl(true) || player.isPhaseUsing(true)) dialog.addAuto(cards);
                        else return "共有" + get.cnNumber(cards.length) + "张牌";
                    },
                },
                content: function() {
                    //if (player.storage.yukari_spiritaway2) {
                        //var cards = player.getExpansions("yukari_spiritaway2");
                        //player.gain(cards);
                        player.gain(player.storage.yukari_spiritaway2);
                            //player.$throw(cards, 1000);   
                    //}
                    delete player.storage.yukari_spiritaway2;
                    player.removeSkill("yukari_spiritaway2");
                },
                "_priority": 0,
            },
            "yukari_spiritaway2": {
                trigger: {
                    global: "phaseEnd",
                    player: "dieBegin",
                },
                lastDo: true,
                popup: false,
                forced: true,
                charlotte: true,
                sourceSkill: "yukari_spiritaway",
                audio: "ext:车万符斗祭:0",
                mark: true,
                marktext: "隐",
                intro: {
                    mark: function (dialog, content, player) {
                        var content = player.storage.yukari_spiritaway2;
                        if (content && content.length) {
                          if (player == game.me || player.isUnderControl() || game.me.hasSkill("yukari_spiritaway")) {
                            dialog.add(content);
                          } else {
                            return '共有' + get.cnNumber(content.length) + '张神隐的牌';
                          }
                        }
                      },
                    content: function (content, player) {
                        var content = player.storage.yukari_spiritaway2;
                        if (content && content.length) {
                          if (player == game.me || player.isUnderControl() || game.me.hasSkill("yukari_spiritaway")) {
                            return get.translation(content);
                          }
                          return '共有' + get.cnNumber(content.length) + '张神隐的牌';
                        }
                      },
                },
                onremove: function(player, skill) {
                    const cards = player.getCards('s', card => card.hasGaintag(skill));
                    if (cards.length) player.loseToDiscardpile(cards);
                },
                content: function() {
                    if (player.storage.yukari_spiritaway2) {
                        //var cards = player.getExpansions("yukari_spiritaway2");
                        //player.gain(cards);
                        player.gain(player.storage.yukari_spiritaway2);
                    } else {
                        player.$throw(player.storage.yukari_spiritaway2, 1000);
                        for (var i = 0; i < player.storage.yukari_spiritaway2.length; i++) {
                            player.storage.yukari_spiritaway2[i].discard();
                        }
                        game.log(player, "弃置了", player.storage.yukari_spiritaway2);
                            //player.$throw(cards, 1000);   
                    }
                    delete player.storage.yukari_spiritaway2;
                    player.removeSkill("yukari_spiritaway2");
                },
                "_priority": 0,
            },
            t: {
                trigger: {
                    source: "damageSource",
                },
                check: function(event, player) {
                    return get.attitude(player, event.player) <= 0;
                },
                content: function() {
                    "step 0";
                    player.draw();
                    var cards = Array.from(ui.ordering.childNodes);
                    while (cards.length) {
                        cards.shift().discard();
                    }
                    "step 1";
                    var evt = _status.event.getParent("phaseUse");
                    if (evt) {
                        game.resetSkills();
                        _status.event = evt;
                        _status.event.finish();
                        _status.event.untrigger(true);
                    }
                },
                "_priority": 0,
            },
            "momiji_disarm": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    source: "damageAfter",
                },
                logTarget: "player",
                filter: function(event, player) {
                  if (!event.card || event.player == player) {
                    return false;
                  }
                  if (event.card.name == 'sha') {
                    return true;
                  }
                  if (event.card.name == 'juedou') {
                    return true;
                  }
                  return false;
                },
                check: function(event, player) {
                  return get.attitude(player, event.player) < 0;
                },
                content: function() {
                    "step 0"
                    //player.draw();
                    //trigger.player.loseHp();
                    player.viewHandcards(trigger.player);
                    "step 1"
                    var cards = trigger.player.getCards('h');
                    var list = [];
                    for (var i = 0; i < cards.length; i++) {
                        if (cards[i].name == 'sha' || get.type(cards[i], 'trick') == 'trick') {
                            list.push(cards[i]);
                        }
                    }
                    if (list.length == 0) {
                        event.finish();
                    }
                    else {
                        trigger.player.addToExpansion(list, player, "giveAuto").gaintag.add("momiji_disarm2");
                        trigger.player.addSkill('momiji_disarm2');
                    }
                },
                "_priority": 0,
            },
            "momiji_sentry": {
                audio: "ext:车万符斗祭:2",
                trigger: {
                    global: "phaseUseBegin",
                },
                filter: function (event, player) {
                    return get.distance(player, event.player) <= 1 && player.canUse('sha', event.player);
                },
                direct: true,
                content: function () {
                    'step 0'
                    player.chooseToUse({ name: ['sha','danmaku_faith'] }, '哨戒：是否对' + get.translation(trigger.player) + '使用一张弹幕？')
                        .set('logSkill', 'momiji_sentry')
                        .set('filterTarget',function(card,player,target){
                        if(target != _status.event.sourcex &&! ui.selected.targets.contains(_status.event.sourcex)) 
                            return false;
                        return lib.filter.targetEnabled.apply(this,arguments);
                    }).set('sourcex', _status.currentPhase);
                    'step 1'
                    if (result.bool == false) {
                        event.finish();
                    }
                },
                ai: {
                    "maixie_defend": true,
                    threaten: 1.5,
                    effect: {
                        target: function(card, player, target) {
                        if (player.countCards("h") > 1 ) {
                                if (player.hasSkillTag("jueqing", false, target)) return [1, -1.5];
                                if (get.attitude(target, player) < 0) return [1, 1];
                        }
                        },
                    },
                },
                "_priority": 0,
            },
            "momiji_solidshield": {
                audio: "ext:车万符斗祭:1",
                trigger: {
                    global: "useCardToTargeted",
                },
                filter: function(event, player) {
                    if (event.player == player || event.target == player) return false;
                    return event.player.getHistory('useCard').length == 1
                        && (event.card.name == "sha"
                            || ((get.type(event.card) == 'delay'
                                 || get.type(event.card) == 'trick')
                                && event.targets.length == 1))
                        && get.distance(player, event.target) <= 1
                        && event.target.isIn();
                },
                check: function(event, player) {
                    return get.attitude(player, event.target) >= 0;
                },
                logTarget: "target",
                content: function() {
                    "step 0";
                    //player.draw();//自
                    //trigger.target.loseHp();//目标
                    //trigger.player.damage();//发起者
                    var card = trigger.cards.filterInD();
                    trigger.getParent().excluded.add(trigger.target).animate=false;
                    trigger.player.addToExpansion(card, player, "giveAuto").gaintag.add("momiji_solidshield_back");
                    trigger.player.addSkill("momiji_solidshield_back");
                },
                subSkill: {
                    back: {
                        trigger: {
                            player: ["phaseDiscardAfter","dieBegin"],
                        },
                        lastDo: true,
                        popup: false,
                        forced: true,
                        charlotte: true,
                        audio: "ext:车万符斗祭:0",
                        marktext: "挡",
                        intro: {
                            markcount: "expansion",
                            content: "cards",
                            mark: function(dialog, current, player) {
                                var cards = player.getExpansions("momiji_solidshield_back");
                                if (player.isUnderControl(true) || player.isPhaseUsing(true)) dialog.addAuto(cards);
                                else return "共有" + get.cnNumber(cards.length) + "张牌";
                            },
                        },
                        content: function() {
                            //if (player.storage.yukari_spiritaway2) {
                                var cards = player.getExpansions("momiji_solidshield_back");
                                player.gain(cards);
                                //player.$throw(cards, 1000);   
                            //}
                            player.removeSkill("momiji_solidshield_back");
                        },
                        sub: true,
                        sourceSkill: "momiji_solidshield",
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "momiji_disarm2": {
                trigger: {
                    player: ["phaseEnd","dieBegin"],
                },
                lastDo: true,
                popup: false,
                forced: true,
                charlotte: true,
                sourceSkill: "momiji_disarm",
                audio: "ext:车万符斗祭:0",
                marktext: "缴",
                intro: {
                    markcount: "expansion",
                    content: "cards",
                    mark: function(dialog, current, player) {
                        var cards = player.getExpansions("momiji_disarm2");
                        if (player.isUnderControl(true) || player.isPhaseUsing(true)) dialog.addAuto(cards);
                        else return "共有" + get.cnNumber(cards.length) + "张牌";
                    },
                },
                content: function() {
                    //if (player.storage.yukari_spiritaway2) {
                        var cards = player.getExpansions("momiji_disarm2");
                        player.gain(cards);
                        //player.$throw(cards, 1000);   
                    //}
                    player.removeSkill("momiji_disarm2");
                },
                "_priority": 0,
            },
            "mima_tianyi": {
                trigger: {
                    global: "useCard2",
                },
                filter: function (event, player) {
                    if (get.type(event.card, 'delay') == 'delay') return false;
                    return (get.type(event.card, 'trick') == 'trick' && get.name(event.card) != 'wuxie') && _status.currentPhase == player &&
                        !player.hasHistory('useSkill', function (evt) {
                            return evt.skill == 'mima_tianyi' || evt.skill == 'mima_tianyi_j';
                        });
                },
                direct: true,
                content: function () {
                    "step 0"
                    //global: "useCard",
                    var bool = false;
                    if (get.attitude(player, trigger.player) < 0) {
                        if (trigger.targets.length == 1 && trigger.player.isAlive()) {
                            bool = true;
                        }
                    }
                    var next = player.chooseBool();
                    next.set('ai', function () {
                        if (_status.event.bool) return 0;
                        return 1;
                    });
                    next.set('bool', bool);
                    next.set('prompt', get.prompt2('mima_tianyi'));
                    "step 1"
                    if (result.bool) {
                        player.logSkill('mima_tianyi');
                        trigger.untrigger();
                        trigger.cancel();
                        //targets.forEach(function(target) {
                        //player.useCard({ name: 'danmaku_faith' }, target);
                    //});
                        event.targets = trigger.targets.slice(0);
                        //trigger.cancel();
                        player.storage.mima_tianyi = trigger.card;
                        //event.finish();
                    }
                    else {
                        event.finish();
                    }
                    "step 2"
                    if (event.targets.length) {
                        player.useCard({ name: 'danmaku_faith' }, event.targets.shift());
                        event.redo();
                    }
                },
                group: ["mima_tianyi_j"],
                subSkill: {
                    j: {
                        trigger: {
                            player: "judgeBefore",
                        },
                        filter: function (event, player) {
                            return _status.currentPhase == player &&!player.hasHistory('useSkill', function (evt) {
                                return evt.skill == 'mima_tianyi' || evt.skill == 'mima_tianyi_j';
                            });
                        },
                        prompt: "###是否发动【天仪】？###你的回合内限一次，一张符卡生效前，你可以使其无效，视为你对该符卡指定的所有目标依次使用一张弹幕。<br>以此法使用的弹幕不受“一回合使用一次”的限制。",
                        content: function () {
                            trigger.cancel();
                            player.storage.mima_tianyi = trigger.card;
                            player.useCard({ name: "danmaku_faith" }, player);
                        },
                        sub: true,
                        sourceSkill: "mima_tianyi",
                        ai: {
                            basic: {
                                useful: [6,4,3],
                                value: [6,4,3],
                            },
                            result: {
                                player: 1,
                            },
                            expose: 0.2,
                        },
                        "_priority": 0,
                    },
                },
                "_priority": 0,
            },
            "mima_eling": {
                trigger: {
                    global: "damageEnd",
                },
                locked: true,
                filter: function (event, player) {
                    return _status.currentPhase == event.player;
                },
                content: function () {
                    player.draw(2);
                },
                "_priority": 0,
            },
        },
        translate: {
            "yuyuko_pcb": "诱死",
            "yuyuko_pcb_info": "出牌阶段限一次，你可以令一名其它角色失去一点体力，然后其于回合结束阶段回复一点体力。回合结束阶段，若你于出牌阶段没有发动过该技能，则所有体力值为1的其它角色失去一点体力。",
            "yuyuko_souldrain": "离魂",
            "yuyuko_souldrain_info": "你的回合内，当一名其它角色进入濒死状态时，你摸一张牌，然后你可以与该角色拼点： <br/>>> 若你赢，则将其体力上限改为1。 <br/>>> 若你没赢，则将其体力值改为1。",
            "yuyuko_pcb_extract": "反魂",
            "yuyuko_pcb_extract_info": "锁定技，一名角色被击坠后，你可以增加一点体力上限或回复一点体力。你的手牌上限是你的体力上限。",
            "daiyousei_support": "支援",
            "daiyousei_support_info": "出牌阶段，你可将任意张牌交给其他角色，此阶段你给出的牌首次达到三张时，你回复1点体力。",
            "daiyousei_moe": "卖萌",
            "daiyousei_moe_info": "锁定技，摸牌阶段你额外摸X张牌（X为你已损失的体力值）。",
            "seiga_heterodoxy": "邪仙",
            "seiga_heterodoxy_info": "出牌阶段，你可以将一张手牌以一名其他角色的身份使用。<br/>>> 以此法使用弹幕消耗你的干劲。<br/>>> 你成为此法使用的群体符卡的目标后，可以跳过此次结算。",
            "flandre_csd": "毁灭",
            "flandre_csd_info": "锁定技，每当你使用弹幕或弹幕战指定其他角色为目标后，其所有技能无效直到回合结束。",
            ganjin: "干劲",
            "ganjin_info": "",
            "干劲描述": "干劲描述",
            "干劲描述_info": "符斗祭专属：<br>①自己的回合开始：获得1点干劲。<br>②回合内：使用弹幕、重铸武器牌需要消耗1点干劲；装备八卦炉时，使用弹幕不消耗干劲。<br>③酒没有使用次数限制且不能在濒死时使用，使用酒的目标获得喝醉状态，效果保持到该角色的下个回合开始。在此期间：使用弹幕，伤害+1并解除醉酒状态；受到致命伤害，此次伤害-1并解除喝醉状态。<br>④作为boss且没有boss技，选择以下技能之一作为boss技：同仇、协力、牺牲、应援。",
            "flandre_cs": "狂咲",
            "flandre_cs_info": "摸牌阶段，你可以少摸一张牌，若如此做，你获得以下效果直到回合结束： <br/>>> 当你没有干劲时，你可以对本阶段内没有成为过弹幕目标的其他角色使用弹幕。 <br/>>> 你为伤害来源的弹幕和弹幕战造成的伤害+1。",
            "flandre_cs_1": "狂咲",
            "flandre_cs_1_info": "",
            "flan_sword": "魔剑",
            "flan_sword_info": "你的普通【杀】视为火属性。当你使用卡牌即将对目标造成伤害时，你对目标造成的伤害+1；若你未受伤，将失去等额体力，否则将体力调整至1点。此后你回复等额的体力。当你成为一张牌的目标时，若你已损失体力大于装备区的牌数，可摸此差值的牌数，再弃置一张牌，否则摸一张牌。",
            "flan_awake": "恶魔之力",
            "flan_awake_info": "觉醒技，当你于第0轮游戏进入濒死时，回复至最大体力，每过1轮减少1点回复值，至少回复体力至1点，摸等同游戏轮数的牌数，获得技能【魔剑】，若游戏轮数大于最大体力则再失去【狂咲】。",
            "shinmyoumaru_mallet": "万宝槌",
            "shinmyoumaru_mallet_info": "当一名角色的判定牌生效前，你可以用一张点数大于此牌的牌替换之。",
            "seiga_extend": "通灵",
            "seiga_extend_info": "限定技，你的回合内，当有角色被击坠时，你可以获得其一个技能。（不包括限定技，觉醒技）",
            "seiga_daotai_max": "结界_初",
            "seiga_daotai_max_info": "其他角色的准备阶段开始，且你没有装备防具时，你获得1点护甲。<br>当你以此法获得护甲，直到自己受到伤害后：<br>①若存在护甲，移除所有护甲并恢复等量体力，摸等同护甲值的牌数；<br>②若存在护甲时处于出牌阶段，再失去1点体力。",
            "seiga_daotai": "道胎动",
            "seiga_daotai_info": "锁定技，其他角色的准备阶段开始，且你没有装备防具时，你获得1点护甲（不超过体力上限），未受伤则额外失去1点体力。<br>当你以此法获得护甲，直到自己的准备阶段或受到伤害后：<br>①若存在护甲，结算后移除所有护甲；<br>②若你的回合外以此法移除护甲，且护甲不小于当前体力或其他存活人数，摸等同护甲值的牌数；<br>③若你的回合内以此法移除护甲，若未受伤，失去1点干劲，否则摸等同护甲值的牌数，再弃置自己任意区域等量的牌。",
            "reimu_exterminate_active": "退治",
            "reimu_exterminate_active_info": "",
            "reimu_clear": "快晴",
            "reimu_clear_info": "你对一名其他角色造成伤害后，你可以与其各摸一张牌，若此时位于其它角色的出牌阶段，停止当前结算并结束出牌阶段。",
            "reimu_tribute": "纳奉",
            "reimu_tribute_info": "BOSS技，其他角色的出牌阶段限一次，若你的手牌数小于体力上限，其可以将一张手牌置入你的明牌区。",
            "reimu_tribute_good": "纳奉",
            "reimu_tribute_good_info": "",
            "reimu_tribute2": "纳奉",
            "reimu_tribute2_info": "",
            "reimu_tribute_bad": "纳奉",
            "reimu_tribute_bad_info": "",
            "visible_cards": "明牌",
            "visible_cards_info": "",
            "reimu_tribute_ok": "纳奉",
            "reimu_tribute_ok_info": "",
            "reimu_exterminate": "退治",
            "reimu_exterminate_info": "其他角色的回合内，你可以于以下时机无视距离对其使用一张弹幕： <br/>>> 出牌阶段，你受到伤害后。 <br/>>> 回合结束阶段，且该角色本回合对其他角色造成过伤害。",
            "reimu_saisen": "赛钱",
            "reimu_saisen_info": "其他角色成为你弹幕或弹幕战的目标时，若其体力大于等于你，其须选择交给你一张任一区域的牌，你再摸一张牌，否则该牌无法被响应，你回复一点体力，摸一张牌。",
            "reimu_damage": "梦想天生",
            "reimu_damage_info": "你使用【杀】无距离限制。锁定技，你使用一张牌后，摸1张牌；若你的体力上限小于等于2，你造成的所有伤害和回复+X，回合结束时使用几张牌，受到几点伤害，否则使用卡牌将失去1点体力上限。手牌上限基数变为场上存活人数。（X为当前游戏轮数）",
            "reimu_awake": "博丽",
            "reimu_awake_info": "觉醒技，游戏开始，场上存在神将，你将体力上限调整为7，获得【梦想天生】。若其他角色获得牌后的手牌比你的装备多7张以上，你获得【赛钱】。",
            "reimu_extra": "博丽",
            "reimu_extra_info": "",
            "kaguya_dilemma": "难题",
            "kaguya_dilemma_info": "每当一名角色令你回复1点体力后，你可以令其摸一张牌；每当你受到一次伤害后，你可以令伤害来源选择一项：<br>>> 交给你一张方块牌，<br>>> 失去1点体力。",
            "kaguya_dilemma_good": "难题",
            "kaguya_dilemma_good_info": "",
            "kaguya_dilemma_bad": "难题",
            "kaguya_dilemma_bad_info": "",
            "kaguya_inight": "永夜",
            "kaguya_inight_info": "你的回合外，每当其他角色使用的红色基本牌置入弃牌堆时，你可以将一张红色基本牌或装备牌当封魔阵对其使用。",
            "tenshi_masochist": "抖M",
            "tenshi_masochist_info": "每当你受到1点伤害后，你可以观看牌堆顶的两张牌，并将这些牌交给至少一名角色。",
            "tenshi_sp": "绯想",
            "tenshi_sp_info": "锁定技，距离1以内的角色的红色判定牌生效后，你获得之。",
            "koakuma_find": "寻找",
            "koakuma_find_info": "出牌阶段限一次，你可以弃置至多X张牌，然后摸等量的牌。（X为场上存活角色数）",
            "nazrin_treasurehunt": "探宝",
            "nazrin_treasurehunt_info": "准备阶段开始时，你可以进行一次判定，若结果为黑，你获得此牌且你可以重复此流程。",
            "nazrin_agile": "轻敏",
            "nazrin_agile_info": "你可以将一张黑色手牌当擦弹使用或打出。",
            "shikieiki_trial": "审判",
            "shikieiki_trial_info": "每当一名角色的判定牌生效前，你可以打出一张牌代替之。",
            "shikieiki_majesty": "威严",
            "shikieiki_majesty_info": "每当你受到一次伤害后，你可以获得伤害来源的一张牌。",
            "medicine_ciguatera": "神经之毒",
            "medicine_ciguatera_info": "一名角色准备阶段开始时，你可以弃置一张黑色牌，令其失去1点体力并获得喝醉状态。",
            "medicine_melancholy": "忧郁之毒",
            "medicine_melancholy_info": "每当你受到一次有来源的伤害后，你可以展示并获得牌堆顶的一张牌，若此牌不是梅花牌，伤害来源不能使用或打出手牌，直到回合结束。",
            "yuuka_rs": "逆鳞",
            "yuuka_rs_info": "每当你成为其他角色使用的单体符卡效果目标时，你可以将其视为弹幕战效果；你的回合外，你可以将一张手牌当做弹幕使用或打出。",
            "yuuka_sadist": "施虐",
            "yuuka_sadist_info": "当你击坠一名角色时，你可以对攻击范围内一名其他角色造成1点伤害；你对体力值为1的其他角色造成的伤害+1。",
            "tewi_lucky": "幸运",
            "tewi_lucky_info": "锁定技，每当你失去最后的手牌时，你摸两张牌。",
            "kogasa_surprise": "惊吓",
            "kogasa_surprise_info": "出牌阶段限一次，你可以选择一张手牌并指定一名其他角色，该角色选择一种花色后，获得此牌并明置之。若此牌与其选择的花色不同，你对其造成1点伤害。",
            "kogasa_jolly": "愉快",
            "kogasa_jolly_info": "锁定技，摸牌阶段摸牌后，你令一名角色摸一张牌。",
            "patchouli_library": "图书",
            "patchouli_library_info": "锁定技，每当你使用非延时符卡时，你摸一张牌；你使用符卡无距离限制。",
            "patchouli_knowledge": "博学",
            "patchouli_knowledge_info": "锁定技，黑桃符卡对你无效。",
            "boss_tongchou": "同仇",
            "boss_tongchou_info": "当你需要使用或打出一张弹幕时，其他玩家可以代替你使用或打出一张弹幕。",
            "boss_xieli": "协力",
            "boss_xieli_info": "当你需要使用或打出一张擦弹时，其他玩家可以代替你使用或打出一张擦弹。",
            "boss_xisheng": "牺牲",
            "boss_xisheng_info": "当你于濒死状态下，被一名角色使用麻薯而回复体力至1后，其可以失去一点体力，令你额外回复一点体力。",
            "boss_yingyuan": "应援",
            "boss_yingyuan_info": "锁定技，每有一名道中存活，你的手牌上限增加一。",
            "喝醉描述": "喝醉描述",
            "喝醉描述_info": "酒没有使用次数限制且不能在濒死时使用，使用酒的目标获得喝醉状态，效果保持到该角色的下个回合开始。在此期间：使用弹幕，伤害+1并解除醉酒状态；受到致命伤害，此次伤害-1并解除喝醉状态。",
            "youmu_nitoryuu": "二刀流",
            "youmu_nitoryuu_info": "你可以同时装备2把武器牌，攻击距离按其中较高者计算，武器技能 同时有效；装备了2把武器时，出牌阶段开始时你多获得1点干劲，你可以主动 弃置其中1张武器牌（执行{人形操控}的效果时你需要交出所有武器）。 ",
            "youmu_mjchz": "迷津慈航斩",
            "youmu_mjchz_info": "锁定技，你使用的弹幕需要连续使用两张擦弹来抵消；与你进行弹幕战的角色每次需要连续打出两张弹幕。",
            "yugi_fp": "怪力",
            "yugi_fp_info": "当你使用弹幕指定了其他角色为目标时，你可以进行一次判定，若为 红色，则此弹幕不能被擦弹响应；若为黑色，则此弹幕造成伤害后，你弃置其1张牌。",
            "yugi_qiangxi": "强袭",
            "yugi_qiangxi_info": "锁定技，你与其他角色计算距离时始终-1。",
            "mokou_reborn": "重生",
            "mokou_reborn_info": "准备阶段开始时，你可以弃置X张红色牌，然后回复1点体力。（X为你的体力值）",
            "mokou_ashes": "浴火",
            "mokou_ashes_info": "结束阶段开始时，你可以失去1点体力，然后摸两张牌。",
            input: "input",
            "input_info": "",
            upgrade: "蒸蒸日上",
            "upgrade_info": "",
            numup: "提升",
            "numup_info": "游戏开始时，若符势力人数不足一半，你的回复量和摸牌数+X。（X为体力上限与已失去体力之和的1/3，向下取整）<br>若场上存在神势力，你临时获得一次技能御结。",
            yujie: "御结",
            "yujie_info": "神山识的御结，去掉减体力上限，不可取消，仅一次有效。",
            "test2": "测试2",
            "test2_info": "2",
            "reimu_exterminate_damage": "退治",
            "reimu_exterminate_damage_info": "",
            mikittawa: "反击",
            "mikittawa_info": "当你受到伤害后，你可以对伤害来源使用一张无法响应的【杀】。",
            sinsackhat: "头套",
            "sinsackhat_info": "",
            suwakohat: "青蛙帽",
            "suwakohat_info": "",
            hezui: "喝醉",
            "hezui_info": "",
            umbrella: "阳伞",
            "umbrella_info": "",
            "无懈#黑桃": "无懈#黑桃",
            "无懈#黑桃_info": "黑桃的无懈可击对你无效。",
            "闪电#黑桃": "闪电#黑桃",
            "闪电#黑桃_info": "判定阶段前，你将判定区的黑桃闪电弃置。",
            "sanae_goddescendant": "神裔",
            "sanae_goddescendant_info": "每当你成为群体符卡的目标后，你可以重铸一张牌并跳过此次结算。",
            "sanae_faith": "信仰",
            "sanae_faith_info": "出牌阶段限一次，你可以令至多两名其他角色各交给你一张手牌，然后你交给其各一张牌。",
            "sanae_miracle": "奇迹",
            "sanae_miracle_info": "出牌阶段，你可以弃置X张牌并摸一张牌；若X为3，你可以令一名角色回复1点体力。（X为你此阶段使用奇迹的次数）",
            fenpai: "分派",
            "fenpai_info": "出牌阶段限一次，你可以令至多两名其他角色各交给你一张手牌，然后你交给其各一张牌。",
            drawup: "强化",
            "drawup_info": "摸牌阶段，多摸X张牌；手牌上限+X。（X为2倍体力上限与体力之差，向下取整）",
            "spflan_four": "四重存在",
            "spflan_four_info": "每当你受到一次不大于你当前体力值的伤害时，你可以减少1点体力上限并防止此伤害；你体力值为1时，你为伤害来源的卡牌造成的伤害+1。",
            "spflan_pohuai": "破坏冲动",
            "spflan_pohuai_info": "锁定技，结束阶段结束后，若你本回合没有造成过伤害，你对距离最近的一名其他角色造成1点伤害，并失去1点体力。",
            "ran_prophet": "神算",
            "ran_prophet_info": "准备阶段开始时，你可以观看牌堆顶的X张牌，将其中任意数量的牌以任意顺序置于牌堆顶，其余以任意顺序置于牌堆底。（X为存活角色数且至多为5）",
            "ran_ei": "极智",
            "ran_ei_info": "每轮限一次，你的回合外，当非延时符卡效果对一名角色生效后，你可以弃置一张牌，令该符卡效果对那名角色重新进行一次结算，此时使用者视为你。",
            "ran_suluo": "素裸",
            "ran_suluo_info": "锁定技，若你没有手牌，符卡对你造成的伤害-1。",
            "rinnosuke_nitoru": "寝取",
            "rinnosuke_nitoru_info": "出牌阶段限一次，你可以弃置两张手牌并指定一名已受伤的其他角色，你与其各回复1点体力。",
            "rinnosuke_psycopath": "变态",
            "rinnosuke_psycopath_info": "锁定技，当你失去一张装备区里的装备牌时，你摸两张牌。",
            "cirno_bakadesu": "最强",
            "cirno_bakadesu_info": "出牌阶段限一次，你可以指定一名攻击范围内有你的角色，该角色选择一项： <br>>> 对你使用一张弹幕。 <br>>> 令你弃置其一张牌。",
            "cirno_perfectfreeze": "完美冻结",
            "cirno_perfectfreeze_info": "每当你使用弹幕或弹幕战对其他角色造成伤害时，你可以防止此次伤害，并令该角色弃置一张牌，若其弃置的不为装备区的牌，其失去1点体力。",
            houraijewel: "蓬莱玉枝",
            "houraijewel_info": "",
            "eirin_ts": "天丝",
            "eirin_ts_info": "出牌阶段限一次，你可以弃置一名角色的一张牌，并令其选择一项： <br>>> 回复1点体力。 <br>>> 展示牌堆底的3张牌，获得其中的非基本牌，并弃置其他的牌。",
            "chen_skanda": "飞翔韦驮天",
            "chen_skanda_info": "出牌阶段限一次，你使用弹幕或单体符卡时，可以额外指定一个目标。 <br>>> 此处不能使用人形操控。",
            "parsee_envy": "嫉妒",
            "parsee_envy_info": "你可以将一张黑色牌当城管执法使用；每当距离1的其他角色的方块牌被你使用的城管执法弃置而置入弃牌堆后，你可以获得之。",
            "chen_shikigami": "式神",
            "chen_shikigami_info": "限定技，出牌阶段，你可以令一名其他角色选择一项：>> 摸两张牌，>> 回复1点体力。 <br>直到下次你的回合开始时，你与其可以在出牌阶段对对方攻击范围内的角色使用弹幕。",
            "eirin_medic": "月弦",
            "eirin_medic_info": "（无ai）你可以将一张手牌置于牌堆顶或牌堆底，如此视为使用或打出一张弹幕。",
            "old_medic": "月弦测试",
            "old_medic_info": "",
            "nitori_craftsman": "匠心",
            "nitori_craftsman_info": "你可以将你的全部手牌（至少1张）当做任意的一张基本牌使用或打出。出牌阶段内使用时，一回合限一次。",
            "nitori_dismantle": "拆解",
            "nitori_dismantle_info": "出牌阶段限一次，你可以重铸一名其他角色装备区里的一张装备牌，然后该角色摸一张牌。",
            "恶心丸测试": "恶心丸测试",
            "恶心丸测试_info": "",
            "shinmyoumaru_venge_old": "付丧神之怨v0",
            "shinmyoumaru_venge_old_info": "每当其他角色装备区的牌因弃置而置入弃牌堆时，你可以进行一次判定，若为9~K，你对其造成1点伤害。",
            "shinmyoumaru_venge": "付丧神之怨",
            "shinmyoumaru_venge_info": "每当其他角色装备区的牌因弃置而置入弃牌堆时，你可以进行一次判定，若为9~K，你对其造成1点伤害。",
            exin: "恶心丸",
            "exin_info": "",
            "ibukigourd_old": "伊吹瓢旧",
            "ibukigourd_old_info": "",
            ibukigourd: "伊吹瓢",
            "ibukigourd_info": "",
            "ganjin_old": "干劲旧",
            "ganjin_old_info": "",
            "chen_shikigami1": "式神",
            "chen_shikigami1_info": "",
            "chen_shikigami2": "式神",
            "chen_shikigami2_info": "",
            "remilia_stg": "神枪",
            "remilia_stg_info": "满足下列条件之一时，你可以令你的弹幕不能被响应： <br>>> 目标角色的体力值 大于 你的体力值。 <br>>> 目标角色的手牌数 小于 你的手牌数。",
            "remilia_vampirekiss": "红魔之吻",
            "remilia_vampirekiss_info": "锁定技，你使用红色弹幕时无距离限制。当你使用红色弹幕对一名其他角色造成伤害后，你回复1点体力。",
            "remilia_scarletmist": "红雾",
            "remilia_scarletmist_info": "BOSS技，限定技，出牌阶段，你可以选择至多X名其他角色（X为存活道中数量），直到你的下个回合开始阶段，所有角色受到以下影响： <br>>> 你与被选择的角色使用弹幕时无视距离，且使用弹幕造成伤害后回复等量的体力。 <br>>> 其他角色使用弹幕时只能指定距离为1的目标。",
            "zhu1": "主公技移除",
            "zhu1_info": "",
            "remilia_scarletmist2": "红雾",
            "remilia_scarletmist2_info": "",
            "meirin_loongpunch": "龙拳",
            "meirin_loongpunch_info": "每当你使用的弹幕被其他角色使用的擦弹抵消时，或其他角色使用的弹幕被你使用的擦弹抵消时，你可以弃置其1张手牌。",
            "meirin_rb": "背水",
            "meirin_rb_info": "觉醒技，准备阶段开始时，若你体力值为全场最低或之一且不大于2时，你减1点体力上限并获得技能太极。 <br>>> 太极：你可将弹幕当擦弹，擦弹当弹幕使用或打出。",
            "meirin_taichi": "太极",
            "meirin_taichi_info": "",
            "meirin_miss": "美铃阵亡",
            "meirin_miss_info": "",
            oldlongquan: "旧龙拳",
            "oldlongquan_info": "每当你抵消其他角色使用杀造成的伤害时，你可以弃置其一张手牌。",
            "sakuya_dagger": "飞刀",
            "sakuya_dagger_info": "你可以将一张装备牌当弹幕使用或打出，以此法使用的弹幕无距离限制。",
            "sakuya_lunadial": "月时计",
            "sakuya_lunadial_info": "锁定技，准备阶段开始时，你执行一个额外的出牌阶段。",
            "suika_heavydrinker": "酒豪",
            "suika_heavydrinker_info": "出牌阶段每名角色限一次，你可以和其他角色拼点，若你赢，视为你和其各使用了一张酒，若你没赢，你不能发动此技能，直到回合结束。",
            "suika_drunkendream": "醉梦",
            "suika_drunkendream_info": "锁定技，你处于“喝醉”状态时，攻击范围+2；准备阶段开始时，你摸一张牌。",
            "marisa_borrow": "借走",
            "marisa_borrow_info": "出牌阶段限一次，你可以获得其他角色的一张牌，然后该角色可以视为对你使用了一张弹幕。",
            "aya_ultimatespeed": "最速",
            "aya_ultimatespeed_info": "锁定技，你的回合内，当你使用本回合的第二张牌时，你摸一张牌，然后你使用卡牌时无距离限制，直到回合结束。",
            "reisen_lunatic": "狂气",
            "reisen_lunatic_info": "当你使用弹幕或弹幕战对其他角色造成伤害后，你可以令其获得技能丧心。 <br>>> 丧心：锁定技，出牌阶段，你不能使用弹幕以外的牌；你使用弹幕只能指定距离最近的目标；结束阶段开始时，你失去此技能。",
            "reisen_mahjongdrug": "生药",
            "reisen_mahjongdrug_info": "每当你因使用麻薯回复体力后，你可以获得喝醉状态。",
            "aya_ultimatespeed_old": "旧最速",
            "aya_ultimatespeed_old_info": "",
            sangxin: "丧心",
            "sangxin_info": "",
            "sp_aya_fengmi": "风靡",
            "sp_aya_fengmi_info": "回合结束时，若你本回合的出牌阶段使用了四种花色的牌，你可执行一个额外的回合。",
            "sp_aya_jizou": "疾走",
            "sp_aya_jizou_info": "（施工中）出牌阶段，你可以弃置一张牌，然后摸一张牌，对你上一张使用的牌的目标角色（或之一）使用之并重复此流程，否则结束你的回合。",
            "kyouko_echo": "回响",
            "kyouko_echo_info": "每当你受到一次伤害后，你可以获得对你造成伤害的牌，若此牌为弹幕，你可以改为令一名其他角色获得之。",
            "kyouko_resonance": "共振",
            "kyouko_resonance_info": "当你对其他角色使用的弹幕结算完毕后，你可以指定另一名其他角色，被指定角色可以对其使用一张无视距离的弹幕。",
            "弹幕补丁": "弹幕补丁",
            "弹幕补丁_info": "",
            "kanako_virtue": "神德",
            "kanako_virtue_info": "摸牌阶段，你可以放弃摸牌，改为令一名其他角色摸两张牌，然后其须展示并交给你一张牌，若交给你的牌为红桃牌，你摸一张牌。",
            "kanako_faith": "信仰",
            "kanako_faith_info": "限定技，出牌阶段，你可以令你攻击范围内的所有其他角色依次选择一项： <br>>> 令你摸一张牌。 <br>>> 弃置你一张牌，然后你视为对其使用了一张弹幕或弹幕战（按此法使用的弹幕不消耗干劲）。",
            "minoriko_foison": "丰收",
            "minoriko_foison_info": "锁定技，摸牌阶段摸牌后，你将手牌数补至五张。",
            "minoriko_autumnfeast": "秋祭",
            "minoriko_autumnfeast_info": "出牌阶段限一次，你可以将两张红色牌当五谷丰登使用。",
            "minoriko_akitribute": "上贡",
            "minoriko_akitribute_info": "锁定技，结算五谷丰登时，你首先选择牌，结算完后，你将剩余的牌置于一名角色的明牌区。",
            "minoriko_foison_old": "旧丰收",
            "minoriko_foison_old_info": "锁定技，摸牌阶段摸牌后，你将手牌数补至五张。",
            "shizuha_decay": "凋零",
            "shizuha_decay_info": "锁定技。你的回合内，每当其他角色失去最后的手牌时，你摸一张牌；你的回合外，每当你受到一次伤害后，当前回合角色于本回合弃牌阶段需额外弃置一张手牌（该效果不可叠加）。",
            "shizuha_autumnwind": "秋风",
            "shizuha_autumnwind_info": "弃牌阶段结束时，你可以弃置至多X名角色各一张牌。（X为你本阶段弃置的手牌数）",
            "komachi_riverside": "彼岸",
            "komachi_riverside_info": "出牌阶段限一次，你可以弃置一张牌并指定一名其他角色，你与其距离视为1直到回合结束，然后若该角色的体力值为全场最少的（或之一），你选择一项：<br>>> 摸一张牌，<br>>> 弃置其一张牌。",
            "komachi_awake": "归航",
            "komachi_awake_info": "觉醒技，准备阶段开始时，若你体力值小于手牌数且不大于2，你减1点体力上限并获得技能渡钱。 <br>>> 渡钱：每当你对距离1的其他角色造成伤害后，你可以获得其一张牌。",
            "komachi_ferryfee": "渡钱",
            "komachi_ferryfee_info": "",
            "kokoro_hopemask": "希望之面",
            "kokoro_hopemask_info": "(无ai)出牌阶段开始时，你可以观看牌堆顶的1+X张牌，然后展示并获得其中任意数量的同花色牌，其余的牌以任意顺序置于牌堆顶。（X为你已损失的体力值）",
            "kokoro_darknoh": "暗黑能乐",
            "kokoro_darknoh_info": "出牌阶段限一次，你可以将一张黑色牌置于体力值不小于你的其他角色的明牌区，然后其须弃置除获得的牌以外的手牌，直到手牌数与体力值相等。",
            "seija_incite": "挑拨",
            "seija_incite_info": "出牌阶段限一次，你可以与一名其他角色拼点，若你赢，视为该角色对其攻击范围内你指定的另一名其他角色使用了一张弹幕；若你没赢，该角色可以视为对你使用了一张弹幕。",
            "seija_reversal": "逆转",
            "seija_reversal_info": "当你受到一名其他角色使用的弹幕效果时，你可以摸一张牌，然后若你的手牌数大于其手牌数，取消该弹幕效果，并视为该角色再对你使用一张弹幕战。",
            "alice_legion": "小小军势",
            "alice_legion_info": "出牌阶段结束时，你可以重铸一张装备牌，然后发动对应的效果： <br>>> 武器：视为对一名其他角色使用了弹幕。 <br>>> 防具：令一名角色回复1点体力。 <br>>> 饰品：摸一张牌并跳过弃牌阶段。 <br>>> UFO：视为使用一张人型操控。",
            "alice_dollblast": "人偶爆弹",
            "alice_dollblast_info": "每当你装备区的牌被其他角色获得或弃置时，你可以弃置其一张牌。若此法弃置的牌为该角色获得的牌，你对其造成1点伤害。",
            "rumia_darkness": "黑暗",
            "rumia_darkness_info": "出牌阶段限一次，你可以弃置一张牌并指定一名其他角色，令其选择一项： <br>>> 对其攻击范围内另一名你指定的其他角色使用一张弹幕。 <br>>> 受到你造成的1点伤害。",
            "rumia_cheat": "作弊",
            "rumia_cheat_info": "锁定技，结束阶段开始时，你摸一张牌。",
            "mamizou_morph": "变化",
            "mamizou_morph_info": "出牌阶段限一次，你可以将两张手牌当任意基本牌或非延时符卡使用，这两张牌中至少有一张须与你声明使用的牌类型相同。",
            "keine_teach": "授业",
            "keine_teach_info": "出牌阶段限一次，你可以重铸一张牌，然后将一张牌交给一名其它角色，其选择一项：<br>>> 使用一张牌，<br>>> 重铸一张牌。",
            "keine_guard_awake": "守护",
            "keine_guard_awake_info": "限定技，出牌阶段开始时，你可以失去一点体力上限，令一名其它已受伤角色回复一点体力。之后，若其体力仍然是全场最低的，则你与其获得技能决意。 <br>>> 决意：当你受到伤害时，若同样拥有决意的另一名角色的体力值比你高，则伤害改为由该角色承受。同样拥有决意的另一名角色于你的回合内摸牌/回复体力时，你摸相同数量的牌/回复相同的体力。",
            "keine_devour": "决意",
            "keine_devour_info": "当你受到伤害时，若同样拥有决意的另一名角色的体力值比你高，则伤害改为由该角色承受。同样拥有决意的另一名角色于你的回合内摸牌/回复体力时，你摸相同数量的牌/回复相同的体力。",
            "keine_devour_current2": "决意",
            "keine_devour_current2_info": "当你受到伤害时，若同样拥有决意的另一名角色的体力值比你高，则伤害改为由该角色承受。同样拥有决意的另一名角色于你的回合内摸牌/回复体力时，你摸相同数量的牌/回复相同的体力。",
            "skill_exinwan1": "恶心丸",
            "skill_exinwan1_info": "",
            startx: "开局布置",
            "startx_info": "",
            "yukari_spiritaway": "神隐",
            "yukari_spiritaway_info": "出牌阶段限两次，你可以将场上的一张牌暂时移出游戏。你可以观看以此法移出游戏的牌。任何角色被紫暂时移出的牌，会在紫的结束阶段后归还回该角色的手牌中。",
            "yukari_spiritaway2_o": "神隐o",
            "yukari_spiritaway2_o_info": "",
            "yukari_spiritaway2": "神隐",
            "yukari_spiritaway2_info": "",
            t: "t",
            "t_info": "t",
            "momiji_disarm": "缴械",
            "momiji_disarm_info": "每当你使用弹幕或弹幕战对其他角色造成伤害后，你可以观看其手牌，并将其中任意数量的弹幕或符卡牌暂时移出游戏。该角色被暂时移出的牌会在该角色下一个弃牌阶段后归还回其手牌中。",
            "momiji_sentry": "哨戒",
            "momiji_sentry_info": "你攻击范围内的一名其它角色的出牌阶段开始时，你可以对其使用一张弹幕。",
            "momiji_solidshield": "坚盾",
            "momiji_solidshield_info": "你距离1以内的角色成为其它角色使用的弹幕或单体符卡的目标后，若此卡牌为其出牌阶段时使用的第一张卡牌，取消之并暂时移出游戏。该角色被暂时移出的牌会在该角色下一个弃牌阶段后归还回其手牌中。",
            "momiji_disarm2": "缴械",
            "momiji_disarm2_info": "",
            "mima_tianyi": "天仪",
            "mima_tianyi_info": "你的回合内限一次，一张符卡生效前，你可以使其无效，视为你对该符卡指定的所有目标依次使用一张弹幕。<br>以此法使用的弹幕不受“一回合使用一次”的限制。",
            "mima_eling": "恶灵",
            "mima_eling_info": "锁定技，一名角色于其回合内受到伤害时，你摸两张牌。",
        },
    },
    intro: "",
    author: "yxq",
    diskURL: "",
    forumURL: "",
    version: "0.5",
},files:{"character":["test_1.jpg","yuyuko.jpg","shinmyoumaru.jpg","daiyousei.jpg","reimu.jpg","flandre.jpg","seiga.jpg","kaguya.jpg","tenshi.jpg","koakuma.jpg","nazrin.jpg","shikieiki.jpg","tewi.jpg","parsee.jpg","rumia.jpg","yukari.jpg","keine.jpg","mima.jpg","medicine.jpg","yuuka.jpg","kogasa.jpg","youmu.jpg","yugi.jpg","sanae.jpg","ran.jpg","eirin.jpg","kanako.jpg","kokoro.jpg","rinnosuke.jpg","spflan.jpg","chen.jpg","remilia.jpg","meirin.jpg","suika.jpg","marisa.jpg","aya.jpg","reisen.jpg","sp_aya.jpg","kyouko.jpg","minoriko.jpg","shizuha.jpg","seija.jpg","komachi.jpg","mamizou.jpg","momiji.jpg","alice.jpg","patchouli.jpg","mokou.jpg","cirno.jpg","nitori.jpg","sakuya.jpg"],"card":["1.png","card_sinsackhat.png","card_suwakohat.png","card_ibukigourd.png","card_umbrella.png","card_sealarray.png","card_houraijewel.png","houraitrick.png","card_wine.png","card_sinsack.png","danmaku_faith.png","card_donationbox.jpg","card_exinwan.png"],"skill":[],"audio":[]},connect:false} 
};